Page 1 of 1

m_worldUserInfo purpose?

Posted: Tue Nov 25, 2014 4:42 pm
by Basroil
Despite having used bullet for a while now, I still don't really know what the damn m_worldUserInfo variable in dynamicsWorld is for. It is literally only used in btDynamicsWorld.h, and can only be added to the world and returned as-is.


Personally I want to just spruce it up a bit so I can enable tick/pretick callbacks from member functions instead of static/ isolated function (to enable a few simplifications to my code), but not sure if it's there for some feature that will be added later

Re: m_worldUserInfo purpose?

Posted: Tue Nov 25, 2014 8:04 pm
by lunkhound
Yeah it doesn't seem very useful. If I want to add something to the dynamics world I just derive a custom version.

The only case I can think of where that pointer would be useful is where a closed-source 3rd party framework or application is managing dynamicsWorlds so that the user can't derive a custom version.

But that's a pretty weak case, I'd say it's just there to clutter up the code. :)

Re: m_worldUserInfo purpose?

Posted: Tue Nov 25, 2014 8:12 pm
by drleviathan
I though the btDynamicsWorld::m_worldUserInfo had a similar purpose as btCollisionObject::m_userObjectPointer: a hook for custom behavior that is not used by Bullet itself. I imagine it might be useful in a custom btDynamicsWorld derivation that needs a backpointer to some larger PhysicsEngine class that owns it... but only if I had code that kept a pointer to a base btDynamicsWorld and didn't necessarily know what type of World it had, and I can't think of a good example right now of when I might have such a situation.

Re: m_worldUserInfo purpose?

Posted: Tue Nov 25, 2014 8:22 pm
by Mako_energy02
drleviathan nailed it. It's just like the user pointer on collision objects for use with wrappers, imo. The part that is odd to me, is why it's on the btDynamicsWorld world and not the base class (btCollisionWorld).