pra
04-05-2007 23:41:03
I'm trying to use the .scene format. Copypasting the code from Ogre wiki was no problem, it created all objects and attachted them to a snige scenenode. Then i tried to create TreeCollision basing on this node, it didn't worked. I looked in the OgreNewt code, that can't possibly work, since it tries to retrieve one mesh attached to the node.
My question: should i create separate bodies for all meshes of the .scene, or should i try to modify OgreNewt to make it look for all meshes? (what's better: lots of small or one large treecollision body?)
if the second one:
(OgreNewt_CollisionPrimitives.cpp)
can i just run the for-loop over and over for each mesh, or ist it more complicated?
My question: should i create separate bodies for all meshes of the .scene, or should i try to modify OgreNewt to make it look for all meshes? (what's better: lots of small or one large treecollision body?)
if the second one:
(OgreNewt_CollisionPrimitives.cpp)
TreeCollision::TreeCollision( const World* world, Ogre::SceneNode* node, bool optimize ) : Collision( world )
{
Ogre::Vector3 scale;
start();
//now get the mesh!
Ogre::MovableObject* obj = node->getAttachedObject(0);
obj->getMovableType();
Ogre::MeshPtr mesh = ((Ogre::Entity*)obj)->getMesh();
//get scale
scale = node->getScale();
//find number of sub-meshes
unsigned short sub = mesh->getNumSubMeshes();
for (unsigned short cs=0;cs<sub;cs++)
{
Ogre::SubMesh* sub_mesh = mesh->getSubMesh(cs);
(...)
}
//done!
finish( optimize );
}
can i just run the for-loop over and over for each mesh, or ist it more complicated?