jitterphysics icon indicating copy to clipboard operation
jitterphysics copied to clipboard

Collision not detected when object is not moving

Open ramonfr2016 opened this issue 7 years ago • 3 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;

ramonfr2016 avatar Dec 30 '16 19:12 ramonfr2016

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.

ramonfr2016 avatar Dec 30 '16 20:12 ramonfr2016

Then I guess this could be closed.

hypervtechnics avatar Oct 07 '18 18:10 hypervtechnics

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

notgiven688 avatar Aug 08 '21 14:08 notgiven688