notgiven688 / jitterphysics

A cross-platform, realtime physics engine for all .NET apps.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Collision not detected when object is not moving

ramonfr2016 opened this issue · comments

I have 2 rigidbodies in my world: a ball (with a sphere shaped rigidbod), and a player (with a cylinder shaped rigidbody).

The player follows the mouse pointer and sets the location of its rigidbody (I know that setting the rigidbody position this way isn't a good practice).

The player's rigidbody is static.

When the player touches the ball, it's able to move it. But when the ball is not moving (0 velocity), the player doesn't affect the ball, it penetrates it.

I tried setting the isStatic property of the player's rigidbody to false, the same thing happened.

What's going on and how can I solve it?

//player's body
playerBody = new RigidBody(cylinder);
playerBody.IsStatic = true;
//ball's body
 ball = new RigidBody(sphere);

Also, to make the ball slow down and simulate friction with the ground, I'm using the following line:

ball.AngularVelocity *= 0.5f;

Ok, it seems that when the ball is completely still, its property isActive is set to false. I fixed this by doing ball.isActive = true each frame. However, now the ball never stops completely. Is there a better solution for this?

Edit: I just realized that rigidbodies have the property allowDeactivation, which answers my question.

Then I guess this could be closed.

@ramonfr2016 I think you found a bug. I will check this. Thanks for reporting.