How to retrieve list of world data

stenyak
Posts: 29
Joined: Fri Aug 12, 2005 4:59 pm

How to retrieve list of world data

Post by stenyak »

I'm trying to use the collada loader, but it doesn't return any list of bodies/etc, so i can't attach them to my graphics engine. I suppose i have to find out myself what has been loaded, but i can't find anything on the API nor in the collada viewer demo.
How can i retrieve a list of all bodies/constraints/etc that have been loaded?

Thanks for any help!
mickey
Posts: 107
Joined: Fri Sep 19, 2008 6:08 pm

Re: How to retrieve list of world data

Post by mickey »

The collada converter adds all the rigid bodies it finds in the dynamics world you pass when you instantiate the class.

That goes the same with the constraints.

In your rendering frame you can loop through all the collision objects by calling btDynamicsWorld::getNumCollisionObjects()

Check out DemoApplication::renderscene(..) and you'd see it draws the collision shapes.

Hope that helps

Cheers,

David
stenyak
Posts: 29
Joined: Fri Aug 12, 2005 4:59 pm

Re: How to retrieve list of world data

Post by stenyak »

Thanks a lot, that's exactly what i needed.
niezz
Posts: 1
Joined: Mon Jun 01, 2009 10:22 pm

Re: How to retrieve list of world data

Post by niezz »

Hi,

I have the same problem here.
I use Ogre3D for renderig. For example, I have a mesh created in Blender and exported to Ogre binary format (.mesh). I've created physics representation for this object and exported to .dae file - graphics and physics representation is splitted in to two files. Now, I can load my .mesh file. With collada converter I can load my physics representation too. But how can I connect these two?
The collada converter adds all the rigid bodies it finds in the dynamics world you pass when you instantiate the class.
Yes, but how can I get for example a pointer to my new object? btDynamicsWorld has a list of objects. Are new objects added to end of this list?
Check out DemoApplication::renderscene(..) and you'd see it draws the collision shapes
I've checked it out - DemoApplication can render shapes using OpenGL. It iterates over objects list, and just render these shapes. In my case - this is Ogre stuff. I just need new position and orientation. And I'm lost here. Look:

I've loaded many objects from .dae. Now let's start to iterate over objects list: first object. I can get position and orientation, but: to which mesh should I apply these new position and orientation?

Thanks,
niezz.