Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RigidBody collision bug? #235

Closed
MatheusZickuhr opened this issue Feb 9, 2022 · 5 comments
Closed

RigidBody collision bug? #235

MatheusZickuhr opened this issue Feb 9, 2022 · 5 comments
Assignees
Labels

Comments

@MatheusZickuhr
Copy link

MatheusZickuhr commented Feb 9, 2022

I have two rigid bodies on a scene, a box (dynamic type) and a floor (static type).

image

When I call physicsWorld->destroyRigidBody(floorRigidBodyPtr) the box colliding with the floor should fall, but it does not.

image

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?

@DanielChappuis
Copy link
Owner

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?

@MatheusZickuhr
Copy link
Author

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!

@DanielChappuis
Copy link
Owner

Ok perfect but it is still a bug. I will need to fix this.
Thanks for reporting this.

@DanielChappuis DanielChappuis self-assigned this Feb 9, 2022
@DanielChappuis DanielChappuis added this to the Release v1.0.0 milestone Feb 9, 2022
@ghost
Copy link

ghost commented Apr 20, 2022

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.

@DanielChappuis
Copy link
Owner

This is now fixed in version v0.10.0 of the library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants