Body.Position = Vector3 causes World.ContactManger.FindNewContacts to be invoked

Topics: Developer Forum
Developer
Jun 10, 2011 at 8:52 AM

Body.Position = Vector3 causes World.ContactManger.FindNewContacts to be invoked. This is a pretty expensive operation, and its done every frame in the solver anyway.

 I don’t expect anyone is relying on the contact detection as a result of manually setting a position. Expecting this level of scene analysis to occur as a result of merely setting the position of the object is a bad idea because finding new contacts is already going to be done in the solver every frame anyway. Contacts are, imho, something the solver should be responsible for managing and not something that should be created outside the solver itself. Perhaps there's a good reason why someone would want to do it the way it currently is though?

I've removed the call to FindNewContacts here locally and everything is working in my next game (Star Ninja). If I get a chance to run the usual tests I am thinking it would be a good idea to commit this as a small but meaningful performance improvement.

Figured I better bring this up here for discussion in case someone has an opinion on it. Seems like a good change to me but maybe I haven't noticed a crucial side effect.