Link between CollisionObject and CollisionWorld

User avatar
majestik666
Posts: 66
Joined: Tue Mar 02, 2010 6:13 am

Link between CollisionObject and CollisionWorld

Post by majestik666 »

Recently i've been facing an issue where my code knows about
a CollisionObject but needs to gain access to the associated CollisionWorld,
and I haven't been able to find any other way than adding a CollisionWorld
pointer on the CollisionObject itself (set/unset within add/remove object on the world)

Is there any other way of doing it that I missed ?

Thanks !
Francois
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Link between CollisionObject and CollisionWorld

Post by Erwin Coumans »

There is no such link.

We avoid circular dependencies in the Bullet code base, and the world already knows about collision objects, so we cannot add a dependency from object to world.

If you need this information, you can add it in your user object (use object->setUserPointer/getUserPointer).
Thanks,
Erwin
User avatar
majestik666
Posts: 66
Joined: Tue Mar 02, 2010 6:13 am

Re: Link between CollisionObject and CollisionWorld

Post by majestik666 »

yes i thought so...

problem is we're already using the userInfoPtr for other purposes ...
guess i will keep that pointer on our local code :)

Thanks for the info !