TreeCollision <-> Box collision problem

rUmbl3

31-10-2006 13:26:07

I am currently loading some entitys and a terrain from file and create respective box collisions and bodys and for the terrain a treecollision. The loading works pretty well, but my problem is that the boxes fall through the terrain and they don't match the models. see this picture showing the boxes lying at the bottom of the OgreNewt::World:

Picture

And now the code to load the boxes:

col = new OgreNewt::CollisionPrimitives::Box(mWorld, StringConverter::parseVector3(shape), orientation, position);

body = new OgreNewt::Body(mWorld, col);
body->attachToNode(node);
body->setPositionOrientation(position, orientation);
body->setMassMatrix(density, Vector3(0,0,0));
body->setStandardForceCallback();

delete col;


The variables should be self-descriptive i think.

And now the loading code for the terrain:

col = new OgreNewt::CollisionPrimitives::TreeCollision(mWorld, node, false);

body = new OgreNewt::Body(mWorld, col);
body->attachToNode(node);
body->setPositionOrientation(position, Quaternion::IDENTITY);

delete col;


The terrain code is perfectly matching the terrain. And i even get a collision with my character. Only the boxes are a problem.

OvermindDL1

05-11-2006 23:45:13

Make sure the objects, when created, are completely above the terrain, no part intersecting.

rUmbl3

06-11-2006 11:59:53

I already did the same code with nxOgre (and it worked pretty well) but then converted the code to OgreNewt because of crossplatform and the stupid systemsoftware. All boxes spawn about 10 units above terrain so that shouldn't be a problem!

nikhil

07-11-2006 11:14:14

are you setting the world size???

rUmbl3

07-11-2006 11:48:37

yes I do .. that was a problem at the beginning but i changed the world size to about 10.000 in each direction ... on the picture i uploaded the boxes are "hanging" at the world bounds