-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Objects sometimes appearing multiple times and/or not being removed from GatherContacts #421
Comments
Looks like I can reproduce it with the default truck toy: 1 Load the truck toy |
Got distracted and accidentally close |
I believe when this was set up that the assumption was that objects would not change types once they are created. Obviously, that's not the case. Most likely the code that removes collisions does not do so with Static types. I can't promise a fix in the near future, but I'll look into this at some point. Since you provided steps to reproduce it shouldn't be hard to hunt down. |
Sure, I may also play around with it to see if/how I can get around it. Maybe by turning off contact gathering for a time or something else. |
I need to do additional testing yet in a clean build of Torque (not a custom project) but when I set an object to gather contacts, then report and monitor those contacts, I noticed that sometimes the .getContactCount() of the object would report contacts when nothing obvious was touching (via debug with OOBB, AABB, and collision shapes).
When I go through and verify the contents of the contact list I sometimes see an object listed twice or more. It almost looks like contact with an object is gathered, then the object is not removed from the list when the contact ends. Bouncing against an object can then put several 'copies' of the object in the list such that even if one of the contacts is later deleted from the scene, its reference sticks. Calling .getContact(index) can then result in an exception being thrown.
EDIT: Changing bodies between static / dynamic / kinematic seems to cause this to happen.
Example: A dynamic body falls to the ground and makes contact with the ground plane. A dynamic body rolls against the now static body and rests in contact with it. The first body is then changed to a static body to prevent it from being moved by the player or being pushed around by other objects. Then later that first body is changed back to dynamic. That seems to increase the likelihood that the original 'contact' is kept perpetually in the contact list after it breaks contact with the ground or other objects)
The text was updated successfully, but these errors were encountered: