Problem with bodies & entities [SOLVED]

ProtoZoo

02-02-2007 21:54:18

Hi there!

I've got a problem with bodies and their attached entities. After some problems getting NxOgre working, I tried to display some debug information. The debug lines are only visible after each 10th compilation - but thats not the worst problem. I saw that the collision mesh fall down in terms of gravity, but the mesh/entity that should represent the body stays on its initial position.

I possibly know the reason - I've worked with PhysX for a long time now - but can't really fix it using NxOgre. My code for creating the body is:


nxOgre::params<nxOgre::rigidbody> params;

params.mNode = Node->getName();
params.mShadows= true;

nxOgre::body *body= this->mScene->createBody(Ogre::String(BigBlack::xmlGetString(Desc, "name")+ "BODY"), file, new nxOgre::meshShape(file, this->mScene), 10.0, params);

// TODO: set body attributes
body->wakeUp();
body->unFreezeAll();


I've really no clue what to do now!

Thanks for your help! :D

betajaen

02-02-2007 22:05:13

I would say, that using the meshShape in a dynamic body would cause all sorts of collision problems.

I've also taken the liberty of rewriting the code to make it more NxOgre-like ;):


nxOgre::body *mBody= this->mScene->createStaticBody(Ogre::String(BigBlack::xmlGetString(Desc, "name")+ "BODY"), file, new nxOgre::meshShape(file, this->mScene), 10.0, nxOgre::params<nxOgre::params>("node:" + Node->getName() + ", shadows: true"));

// TODO: set body attributes
mBody->wakeUp();
mBody->unFreezeAll();

ProtoZoo

02-02-2007 22:08:24

I would say, that using the meshShape in a dynamic body would cause all sorts of collision problems.

I've also taken the liberty of rewriting the code to make it more NxOgre-like ;):


nxOgre::body *mBody= this->mScene->createStaticBody(Ogre::String(BigBlack::xmlGetString(Desc, "name")+ "BODY"), file, new nxOgre::meshShape(file, this->mScene), 10.0, nxOgre::params<nxOgre::params>("node:" + Node->getName() + ", shadows: true"));

// TODO: set body attributes
mBody->wakeUp();
mBody->unFreezeAll();


Ok, thanks a lot! So I try to avoid using meshShapes with dynamic objects. :)

betajaen

02-02-2007 22:14:45

If you want to use a complicated non-primative shape in a dynamic body, then the only but best way is a compound (shapeGroup) of convex and primatives (cube, sphere, capsule) shapes.

ProtoZoo

02-02-2007 22:37:00

Jep, I did that now! :) I need a very detailed collision thingy - so I tried to do it with a comound first and decided to give the meshShape a try. But there aren't any restrictions about the number of shapes in such a group, right?!

betajaen

02-02-2007 22:57:18

Shouldn't be. But I wouldn't go over the top, say 8-10.

ProtoZoo

03-02-2007 12:10:23

I've managed to get it working with the compound shapes. Thanks a lot!