Multiple entites in a tree

Vectrex

01-06-2006 18:36:10

I'm tring to add entites from an OSM scene file into a tree collision, much like this post does with dotScene http://www.ogre3d.org/phpBB2addons/view ... t=dotscene

but my collision mesh (F3) is misaligned to the visible geometry. Here's the code

void TrackManager::OnEntityCreate(Ogre::Entity *pEntity, TiXmlElement* pEntityDesc){
OgreNewt::Body* body = NULL;
OgreNewt::Collision* col = NULL;
col = new OgreNewt::CollisionPrimitives::TreeCollision(mOgreNewtWorld, pEntity->getParentSceneNode(), false);
body = new OgreNewt::Body(mOgreNewtWorld, col);
body->attachToNode(pEntity->getParentSceneNode());
delete col;
}


- does this make loads of seperate tree bodies? If so is there a way to add new entities to an exist tree collision or doesn't this matter?

walaber

01-06-2006 19:48:23

the standard TreeCollision constructor takes the FIRST Entity attached to teh scene node, and makes the collision from it, only (IIRC).

Vectrex

02-06-2006 04:15:07

hmm so the dotScene addition in that thread wouldn't/shouldn't work?
so.. (thinking) I could add all the static entities into an ogre static mesh and give that too it? (goes off and tries it)

walaber

02-06-2006 05:09:13

I suppose it would be a good idea to make a new version that creates a single tree Collision from an entire tree of SceneNode(s).

it wouldn't be too hard come to think of it... just parse the scene node's children recursively, and apply that scene node's global position/orientation to the local vertices...

I will add it to my list of things to do...

walaber

02-06-2006 06:25:19

added! see the update thread for more info!!

Vectrex

02-06-2006 08:02:15

haha, an hour, now THAT'S service :D