MeshShape

M@gg!

10-08-2006 12:12:00

I have a little problem.

We are using a castle as model and it has bevels. So I can't use simple Shapes like cubeShape.

So I tried to use a meshShape, the castle is not complex and we created a more simple mesh for the shape. But now I'am having the problem, that each other mesh with meshShape attatched does not collide with the castle.

Why?
And how do I create a god working shape for the castle?

betajaen

10-08-2006 12:49:51

What is the code you are using to create the body and shape?

What does it look like in debugMode?

M@gg!

10-08-2006 15:14:37

Allow me a stupid question. What exactly do you mean with debugMode?

Some snippets of my code:


//Set Castle
nxOgre::body *myCastle = mScene->createBody("castle", "castle_simple.mesh"
, new nxOgre::meshShape("castle_simple.mesh", mScene)
, 10.0f, Ogre::Vector3(0, height, 0));

Ogre::Entity *entCastle = mSceneManager->getEntity("castle");
entCastle->setMaterialName("snow");


nxOgre::material *defaultMaterial = mScene->findMaterial("Default");
defaultMaterial->setBounce(0.0);
defaultMaterial->setDynamicFriction(1);
defaultMaterial->setStaticFriction(1);


betajaen

10-08-2006 16:44:18

The code seems fine.

I mean the debug renderer (funny lines the appear on the screen), or when you press F2 in the tutorials.

Or basically:


mWorld->debug(true);

BlasterN

10-08-2006 21:37:37

I think MeshShape can't collide against other MeshShape (and maybe against ConvexShape) only primitives.

betajaen

10-08-2006 21:43:18

Argh!!, I didn't read his post properly.

Yep, sadly meshShapes can't collide with other meshShapes. It's best to use a mixture of regular shapes (cube,sphere,capsule) and convexShapes in shapeGroups to make up an approximation of the other meshShape.

M@gg!

11-08-2006 03:02:39

Argh!!, I didn't read his post properly.

Yep, sadly meshShapes can't collide with other meshShapes.


I've had this very bad feeling right from the beginning. :cry:

betajaen

11-08-2006 10:28:08

I wouldn't worry about it to much.

It can be replicated via shapeGroups, besides I imagine shoving an entire mesh in there without optimisation is really hard on the solver, and perhaps the reason why it's not implemented.

M@gg!

11-08-2006 10:41:06

It can be replicated via shapeGroups, besides I imagine shoving an entire mesh in there without optimisation is really hard on the solver

But it is much easyer to create a second very simple mesh for collision and put a mesh shape around it.

betajaen

11-08-2006 10:59:52

Of course it is, it's just something PhysX won't do I'm afraid.

Like I said breaking the mesh down into separate pieces/shapes, but probably the better way although not easier. :D