physics

Applying Coefficient of Restitution in a collision resolution method

橙三吉。 提交于 2019-12-11 03:16:15
问题 I have a collision resolution method in my physics engine, that goes like this: Vector2 n1pos = n1.NonLinearSpace != null ? n1.NonLinearPosition : n1.Position; Vector2 n2pos = n2.NonLinearSpace != null ? n2.NonLinearPosition : n2.Position; Vector2 posDiff = n2pos - n1pos; Vector2 posDiffNormal = posDiff; posDiffNormal.Normalize(); float totalRadius = n1.Radius + n2.Radius; float posDiffLength = posDiff.Length(); float interPenetration = totalRadius - posDiffLength; float averageRestitution =

Verlet integrator + friction

女生的网名这么多〃 提交于 2019-12-10 22:16:13
问题 I have been following "A Verlet based approach for 2D game physics" on Gamedev.net and I have written something similar. The problem I am having is that the boxes slide along the ground too much. How can I add a simple rested state thing where the boxes will have more friction and only slide a tiny bit? 回答1: Just introduce a small, constant acceleration on moving objects that points in the direction opposite to the motion. And make sure it can't actually reverse the motion; if you detect that

Brick Collision Java [closed]

时间秒杀一切 提交于 2019-12-10 20:55:26
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 5 years ago . I have been working on a Breakout game and have just about everything done except for the brick collision. The ball bounces of the wall and paddle fine, but when it comes to the brick it goes straight through them. I'm pretty sure the problem is in the checkBrick() part of the

Any way to implement deterministic physics in AS3?

守給你的承諾、 提交于 2019-12-10 19:26:24
问题 It seems like Box2D for actionscript 3 is not deterministic, it means, in the event of a multiplayer game wheere physics plays an important role in determining who wins/loses, the results would be different for each user if their microprocesors are from different technologies (intel and amd for example). So, is there a way to implement deterministic physics in AS3?, was this achieved before?. Thanks. 回答1: I once had this problem. We used Havok engine in Shockwave Director to simulate a

Adding wxPython GUI elements in a pygame physics simulation

亡梦爱人 提交于 2019-12-10 18:52:44
问题 I have made a pygame physics simulation--'a projectile motion' but it lacks interactivity like accepting angle of launch,speed etc. I am wanting to add input boxes with increase decrease arrows but don't know how to go about it. Thanks for the help. 回答1: Maybe you can try PGU (Phil's pyGame Utilities). In addition to other tools, it has a library for creating GUIs. This PGU demo shows probably something similar to that you are looking for: 回答2: Try Some of these: http://wiki.wxpython.org

For C++ Vector3 utility class implementations, is array faster than struct and class?

强颜欢笑 提交于 2019-12-10 14:26:43
问题 just out of curiosity, I implemented vector3 utilities in 3 ways: array (with a typedef), class and struct This is the array implementation: typedef float newVector3[3]; namespace vec3{ void add(const newVector3& first, const newVector3& second, newVector3& out_newVector3); void subtract(const newVector3& first, const newVector3& second, newVector3& out_newVector3); void dot(const newVector3& first, const newVector3& second, float& out_result); void cross(const newVector3& first, const

Using GPU to speed up BigInteger calculations

耗尽温柔 提交于 2019-12-10 12:43:43
问题 I am almost done with an algorithm that processes some very large integers (around the order of 2 raised to the power 100,000,000). This takes a couple of hours of highly-parallel code on a 16 core server with more than adequate memory since the algorithm is not memory intensive. I make use of the BigInteger class in .NET 4. The specifics of the algorithm are not important but for context, following is a pretty exhaustive list of operations performed on these integers and some salient

2D soft bodies: Gelly and moldable?

狂风中的少年 提交于 2019-12-10 12:31:25
问题 I am using Matter.js physics in an attempt to create soft bodies. I was able to create a body like this: However I am not sure if this is the "soft body" I want. It is true that this body is not entirely rigid and has that bouncy feel when it collides and gets dragged. I was looking for a body that shares similarities with a gelly. This image might visually help explaining the concept: I was wondering how these type of bodies can be made. Is it the same as the as matter.js soft body but with

Scenekit PhysicEngine follow rolling ball

空扰寡人 提交于 2019-12-10 10:25:48
问题 I want to follow a rotating sphere in Apple's SceneKit. I've added an LookAt Constraint to the camera and as the sphere falls down the cam aleays points to it but if the sphere rolls away the camera stays at its current position. I want the cam to follow this sphere like in a third persond shooter with a predefined distance to it. If I make the cam a childNode of the sphere the cam "orbits" around it as the ball is rolling. Any ideas how I can follow the ball with the cam? 回答1: It's pretty

Does sympy give me wrong results for the second quantization commutators?

て烟熏妆下的殇ゞ 提交于 2019-12-10 10:09:41
问题 I am using the following code in sympy : from sympy.physics.secondquant import F, Fd, NO, Commutator from sympy import symbols a, b, c, d = symbols("a,b,c,d") comm = NO(Commutator( Fd(a) * F(b), Fd(c) * F(d) ).doit()) print(comm) # gives me 0 Clearly, this should not be zero. Well, maybe I do not understand sympy . Here is what I want to calculate: [F†_a F_b, F†_c F_d] with not necessarily equal indices a, b, c and d. 来源: https://stackoverflow.com/questions/52227318/does-sympy-give-me-wrong