Character falling through a plane

Loockas

02-08-2007 10:01:36

Hi, I'm using DotScene format in my game and I load all my geometry via XML and I apply a static body to every object. My character is acting good with all the objects except for a plane which is a ground. It's falling through it and I have no idea why. :?

Here is my code:
NxOgre::Body* NewBody;
NxOgre::Pose mPose(NewNode->getPosition(), NewNode->getOrientation());
NewBody = mScene->createBody(EntityMeshFilename, new NxOgre::TriangleMeshShape(EntityMeshFilename), mPose, "static: yes, node-scale: " + StringConverter::toString(NewNode->getScale()));

betajaen

02-08-2007 10:38:21

It's a bug to do with PhysX that has been around since the dawn of man.
You need a actor cube underneath the plane, like so:

mScene->createActor("FakeFloor", new CubeShape(1024,0.5,1024), Vector3(0,-0.25,0), "static: yes");

Also try this:-

NxOgre::Body* NewBody;
NxOgre::ActorParams params;
params.setToDefault();
params.setToStatic();
params.nodescale = NewNode->getScale();


NewBody = mScene->createBody(EntityMeshFilename, new NxOgre::TriangleMeshShape(EntityMeshFilename), NxOgre::PosePose(NewNode->getPosition(), NewNode->getOrientation()), params);


Less string usage ;)

Loockas

02-08-2007 10:48:56

It's a bug to do with PhysX that has been around since the dawn of man.
Really? Never heard of it.. I must have missed something. :lol:

You need a actor cube underneath the plane, like so:
mScene->createActor("FakeFloor", new CubeShape(1024,0.5,1024), Vector3(0,-0.25,0), "static: yes");

Yup, just thought about it, thanks! :wink:


Also try this:-
NxOgre::Body* NewBody;
NxOgre::ActorParams params;
params.setToDefault();
params.setToStatic();
params.nodescale = NewNode->getScale();


NewBody = mScene->createBody(EntityMeshFilename, new NxOgre::TriangleMeshShape(EntityMeshFilename), NxOgre::PosePose(NewNode->getPosition(), NewNode->getOrientation()), params);


Less string usage ;)

That's better indeed, thanks! :wink:

betajaen

02-08-2007 10:59:00

Indeed.

All param's systems work that way; SceneParams, WorldParams, ClothParams, etc. But it's not worth the extra lines when you have one or two params to pass on.