3 questions about NxOgre,something do not work...

kidcdf

18-01-2008 09:46:13

1.Body=mNxScene->createBody(Modelname+";"+filename, new NxOgre::CubeShape(1.0f), Vector3(0,0,0), "mass: 10, static:no");

I don't know the boundingbox of body,so whether can I get the size automatically instead of "CubeShape(1.0f)"?

2.I have added a Ogre::Geometry and a car(body) into my world, then I write "body->addForce(Vector3(10,0,10))",but my car doesn't move.

3.how can I scale the geometry?

thx for helping!

NickM

18-01-2008 16:28:06

You are best off using a purposely modelled shape for the collision shape really, pass the .mesh model to a ConvexShape or a TriangleShape and NxOgre will create the PhysX shape for you.

Is Vector3(10,0,10) enough force to move the body? try adding more.

I'm not sure about question 3.

fzh

19-01-2008 00:21:41

1.if you want to use box for collision detection, here's a short code for finding the box size from bounding box.

Ogre::AxisAlignedBox charAAB = mEntity->getBoundingBox();
Ogre::Vector3 min = charAAB.getMinimum();
Ogre::Vector3 max = charAAB.getMaximum();
Ogre::Vector3 center = charAAB.getCenter();
Ogre::Vector3 size( fabs( max.x - min.x), fabs( max.y - min.y), fabs( max.z - min.z ) );

then just use size.x, size.y and size.z in CubeShape.


2.not sure, need more info, try adding more force.

3.What I did was getting the node and scale it. For collision scaling, just have size parameters times the scale factor when creating the shape.