As part of researching how to best integrate a physics engine into my game, I was looking at the source code for Urho3D. For the most part what they've done is pretty straightforward, however for implementing ghosts or "triggers" they're using a btRigidBody with the 'CF_NO_CONTACT_RESPONSE' flag set. Bullet already has a btGhostObject class for doing stuff like that, so besides possibly saving on memory is there any compelling reason to use that instead of the solution that Urho3D has gone with? Does it have more features? Is it more efficient?
At the moment I'm leaning strongly towards using btRigidBodies for everything, since as hyyou said having the same code for everything makes stuff simpler. Besides, it doesn't look like you can attach constraints to ghost objects (potentially useful for cases where one end of the constraint isn't affected).
Thanks
btGhostObject vs btRigidBody with CF_NO_CONTACT_RESPONSE
-
- Posts: 9
- Joined: Sun Dec 01, 2013 6:53 am
btGhostObject vs btRigidBody with CF_NO_CONTACT_RESPONSE
Last edited by willcassella on Tue Apr 05, 2016 8:26 pm, edited 1 time in total.
Re: btGhostObject vs btRigidBody with CF_NO_CONTACT_RESPONSE
Thank willcassella, I also doubt about the same issue and almost created this same topic.
I don't know the answer either, but here is all related information that I have :-
I don't know the answer either, but here is all related information that I have :-
- 1. The functions to add two types of object into the dynamicWorld are different :-
2. btRigidBody is somehow derived from btGhostObject. Memory saving? I guess it is not much.
Code: Select all
dynamicsWorld->addRigidBody(rigid, this->mask.m1(), this->mask.m2()) dynamicsWorld->addCollisionObject(body, this->mask.m1(), this->mask.m2()) dynamicsWorld->removeRigidBody(rigid); dynamicsWorld->removeCollisionObject(body);
3. By using CF_NO_CONTACT_RESPONSE, we can use the same code that we have wrote to manage RigidBody to manage this sensor too.
Less code -> less bugs.