Page 1 of 1

[Solved] Accessing the world via a rigid body

Posted: Tue Apr 01, 2014 3:46 pm
by bwelch
Hi everyone. I have what I think is an easy question, but I can't seem to find a solution.

Is it possible to get a pointer to the world that a rigid body lives in from that rigid body? I was looking for something like rigidbody->getWorld() but there doesn't seem to be anything like that. In my project, I use Bullet to control some of the objects in a scene, and a specialized physics engine to handle select other pieces. I have a step in my other engine where I step the simulation to a certain time, and I need to update the Bullet world to that time, too. Unfortunately, as it is now, that other engine can only get pointers to Bullet rigid bodies and nothing else.

So what I'd like to have is something like:

Code: Select all

StepOtherEngine(timestep/2);
rigidbody->getWorld()->stepSimulation(timestep/2, 50, timestep/2);
Is it possible to do this somehow? Thanks!

Re: Accessing the world via a rigid body

Posted: Tue Apr 01, 2014 4:27 pm
by bwelch
I managed to figure out a way to access the world, and it turns out it was easy. It was more of a C++ thing than a Bullet thing. In my case, Bullet lives in a separate class called BulletPlugin, so I was able to access the world by using BulletPlugin::world. No need to go through the rigidbody to get it.