Problem with SphereGeometry and Trimesh Geometry

llamaman58

21-04-2008 11:43:58

I have a world that's a trimesh geometry. If I make BoxGeometry's the body stays on top of the trimesh, but being a box, isn't very mobile.

So, I've tried to use a SphereGeometry instead, but when I do, the body clips through my floor, off into infinity. Any idea why this is happening?

The relevant line changes from
geom = (OgreOde::Geometry*)new OgreOde::BoxGeometry(size, this->mWorld, this->mSpace);

to

geom = (OgreOde::Geometry*)new OgreOde::SphereGeometry(size.y*5, this->mWorld, this->mSpace);

I'm using the Ogre SDK, and the current versions of OgreODE and ODE.

rewb0rn

21-04-2008 15:34:18

hm strange. are you sure size.y is greater 0? show how you create the body pls.

llamaman58

21-04-2008 20:23:34

...

this->pinkEnt = mSceneMgr->createEntity(this->playerName + "_pinkEnt", pinkEntName);
this->pinkEnt->setQueryFlags (1<<2);

this->modelNode->attachObject(pinkEnt);
this->pinkEnt->setNormaliseNormals(true);
this->pinkEnt->setCastShadows(true);

Vector3 size(1.0,1.0,1.0);
OgreOde::Body* body = new OgreOde::Body(this->mWorld);
modelNode->attachObject(body);
OgreOde::Geometry* geom = 0;

geom = (OgreOde::Geometry*)new OgreOde::SphereGeometry(size.y*5, this->mWorld, this->mSpace);

modelNode->setScale(1.0,1.0,1.0);

OgreOde::BoxMass mass(1.0,size);
mass.setDensity(0.5,size);
body->setMass(mass);

geom->setBody(body);
pinkEnt->setUserObject(geom);

...

I think that's all the relevant code.

rewb0rn

21-04-2008 21:27:49

try with spheremass instead of boxmass, although i dont think its the reason.. and you know you dont need to write this-> all the time?