TreeCollision Problem

Mf_Gh

14-03-2007 09:17:04

Hello!
my Programm crashs when i use TreeCollison from my Terrain SceneManager


SceneNode *ter;
ter=mterrain->getTerrainRootNode();
OgreNewt::Collision *terraincoll=new OgreNewt::CollisionPrimitives::TreeCollision(mWorld,ter,true);
OgreNewt::Body *terrain=new OgreNewt::Body(mWorld,terraincoll);
delete terraincoll;
terrain->attachToNode(mterrain->getTerrainRootNode());



and i get this Error
"10:12:43: OGRE EXCEPTION(2:InvalidParametersException): Object index out of bounds. in SceneNode::getAttachedObject at C:\SoftwareDevelopment\C++\MinGW\ogrenew_HEAD_clean\OgreMain\src\OgreSceneNode.cpp (line 159)"

Dibalo

14-03-2007 15:45:25

Have you created child scene nodes into terrainRootNode? If so, that´s the problem. You have to mod the treecollision code if you want to pass a node with child nodes. I have done it and it works well. :)

nikhil

17-03-2007 08:29:58

Have you created child scene nodes into terrainRootNode? If so, that´s the problem. You have to mod the treecollision code if you want to pass a node with child nodes. I have done it and it works well. :)

isn't
CollisionPrimitives::TreeCollisionSceneParser
supposed to do that for you?

Mf_Gh

17-03-2007 16:01:39

thanks for the answer i get no error if the scenenode has no child.
but if i use treecollisionssceneparser my entities fall through the terrain :(

nikhil

18-03-2007 00:58:00

thanks for the answer i get no error if the scenenode has no child.
but if i use treecollisionssceneparser my entities fall through the terrain :(


Can you see the collision lines for your objects and check is it even making the collision shapes for your meshes or not??

Mf_Gh

18-03-2007 12:58:12

no i can't see the lines :(

nikhil

19-03-2007 09:40:10

hmm.. i'll have to check it out.. i've tried the sceneparser once, but don't remember if I did've a child node. I remember having two entities, don't remember if they were attached to same node or in a parent-child fashion..