Immoho
22-12-2007 04:53:08
Hi guys.
I am a new user of NxOgre and I use OgreODE before.
I have already read betajean's short guide and known the conception such as world,scene,actor.
But I am still confused about them.Here the questions.
Generally,how u guys create a bouding box and attach the mesh to it?
Using Body or the Actor?What's the diffrence between them?
How the collision detection of NxOgre works?U know,in OgreODE u can use spaceCollied.
How to create a boundding box and capsule a node into it?
I will be appreciated.
betajaen
22-12-2007 08:43:18
I don't know OgreODE that well. But if I think I know what your talking about, we don't use bounding boxes in that way. It is used in the Physical collision code of course, but it's to low-level for NxOgre and there are no PhysX api to control such things.
Actor is just a rigid body with some optional mass, and a shape attached to it. Like a crate, or a pencil, or a house. Actors don't have any visual representation. Bodies are actors but they do have visual representation (scenenode/entity).
mScene->createBody("myName;myMeshName.mesh", new CapsuleShape(radius, height), Vector3(0,5,0), "mass: 10");
Immoho
22-12-2007 10:39:47
I don't know OgreODE that well. But if I think I know what your talking about, we don't use bounding boxes in that way. It is used in the Physical collision code of course, but it's to low-level for NxOgre and there are no PhysX api to control such things.
Actor is just a rigid body with some optional mass, and a shape attached to it. Like a crate, or a pencil, or a house. Actors don't have any visual representation. Bodies are actors but they do have visual representation (scenenode/entity).
mScene->createBody("myName;myMeshName.mesh", new CapsuleShape(radius, height), Vector3(0,5,0), "mass: 10");
Thank u betajaen.I got it,and another question.
When I create a body like that,does that means the CapsulesShape is the collision geometry?
How to use the customed Shape,and adjust the position of the Shape that relative to the entity?For exmaple ,I want to use a geometry created and exported from 3DMax 9, which has hundreds of triangle to make the sure the collision detection's accuracy?
betajaen
22-12-2007 18:18:35
Yeah, I think Collision Geometry in ODE, is the same as PhysX/NxOgre shape.
dbrock
23-12-2007 02:19:21
I don't know OgreODE that well. But if I think I know what your talking about, we don't use bounding boxes in that way. It is used in the Physical collision code of course, but it's to low-level for NxOgre and there are no PhysX api to control such things.
Actor is just a rigid body with some optional mass, and a shape attached to it. Like a crate, or a pencil, or a house. Actors don't have any visual representation. Bodies are actors but they do have visual representation (scenenode/entity).
mScene->createBody("myName;myMeshName.mesh", new CapsuleShape(radius, height), Vector3(0,5,0), "mass: 10");
Thank u betajaen.I got it,and another question.
When I create a body like that,does that means the CapsulesShape is the collision geometry?
How to use the customed Shape,and adjust the position of the Shape that relative to the entity?For exmaple ,I want to use a geometry created and exported from 3DMax 9, which has hundreds of triangle to make the sure the collision detection's accuracy?
You could use a ConvexShape, and pass your *.mesh file as a parameter. It will cook it for you. A ConvexShape should be used as a last resort, meaning, you couldn't build collision shapes out of boxes, spheres, capsules, all common shapes to represent just about any object. ConvexShape should be used when none of the above can get the job done.
NxOgre::ShapeBlueprint *propBlueprint;
NxOgre::ShapeParams propShapeParams;
NxOgre::ActorParams propActorParams;
propShapeParams.setToDefault();
propShapeParams.mMeshScale = NxVec3( 1, 1, 1 );
propActorParams.setToDefault();
propActorParams.mNodeScale = Ogre::Vector3( 1, 1, 1 );
propActorParams.mDensity = 0;
propActorParams.mMass = 10;
propActorParams.mLinearDamping = 0.25f;
propActorParams.mAngularDamping = 0.25f;
propBlueprint = new NxOgre::ConvexShape( "your_mesh.mesh", propShapeParams );
NxOgre::Body *body = mScene->createBody( "your_mesh.mesh", propBlueprint, NxOgre::Pose( Ogre::Vector3(0, 0, 0), Ogre::Quaternion::IDENTITY ), propActorParams );
Immoho
23-12-2007 02:54:50
Thanks dbrock!
The code u given is very useful to a new user of NxOgre.
dbrock
23-12-2007 03:03:39
Just a heads up, if your program crashes, it's likely because your *.mesh file isn't a convex shape, meaning; curved in-ward (concave).
betajaen
23-12-2007 09:58:04
No it's not because of that. PhysX will cook meshes that aren't convex but will make changes to them, so that they are.
It crashes because the cooking process failed; either duplicate vertices are used, the memory allocator cannot allocate memory, or the file/path that it has to cook to doesn't exist.