reactphysics3d
reactphysics3d copied to clipboard
RigidBody collision bug?
I have two rigid bodies on a scene, a box (dynamic type) and a floor (static type).
When I call physicsWorld->destroyRigidBody(floorRigidBodyPtr)
the box colliding with the floor should fall, but it does not.
If I destroy the floor`s rigid body before the box hit it, the ploblem does not happen. Is that intended behavior, or it is a bug?
Hello,
It could be a bug yes. It might be because the bodies are sleeping and the box is not awaken when the floor is destroyed. Could you try to wake up the box rigid body after the floor is destroyed using the following code?
boxRigidBodyPtr->setIsSleeping(false);
Does it work now?
Hello,
It could be a bug yes. It might be because the bodies are sleeping and the box is not awaken when the floor is destroyed. Could you try to wake up the box rigid body after the floor is destroyed using the following code?
boxRigidBodyPtr->setIsSleeping(false);
Does it work now?
Hello, boxRigidBodyPtr->setIsSleeping(false);
fixed it. Thanks!
Ok perfect but it is still a bug. I will need to fix this. Thanks for reporting this.
This kind of bug is too hard for me to solve it in my simple arcade physics. For you don't wast so many time, I solve it like this: 1-add a vector of the position to the body when the world starts the update (preUpdate) 2-with the oldPosition, check after all bodies update (postUpdate) if the oldPosition, is nearly the currentPosition (updated one). Nearly, I would say, the current position is "almost" the oldPosition, thinking like it is in a threshold. It's aproximately like sleeping, but, it differs that you must check the threshold for each world update, what can be hard for many updated objects.
This is now fixed in version v0.10.0 of the library.