Mesh Shapes colliding

joi

11-03-2006 21:16:28

Mesh shapes cant collide with themselfs ?

Im trying to create two dynamics spheres from a mesh file. The reason why im using meshShape instead of sphereShape, its because its much smother when colliding, rolling and frictioning with another surfaces... they do collided with the floor, witch is a static body, but no collision happens between the two of the spheres. :?

Just a simple question... :roll:

[edit]
Using sphereShape its nice, but when they collied, the friction is not kicking in, they roll, and roll, and roll... can you tell me why?


mWorld = new nxOgre::world( Game::getInstance()->getRoot() );

mScene = mWorld->createScene( "defaultScene", Game::getInstance()->getSceneManager() );
mScene->hasFloor();
mScene->hasGravity();

mScene->mDefaultMaterial->setBounce( 0.2f );
mScene->mDefaultMaterial->setStaticFriction( 1 );
mScene->mDefaultMaterial->setDynamicFriction( 1 );

mScene->createStaticBody(
"table",
"table.mesh",
new nxOgre::cubeShape( Ogre::Vector3( 21, 0.2, 10.5 ) ),
Ogre::Vector3::ZERO );

mScene->createBody(
"ball",
"ball.mesh",
new nxOgre::sphereShape( 0.3 ),
50,
Vector3(1,8,0.1) );

mScene->createBody(
"ball1",
"ball.mesh",
new nxOgre::sphereShape( 0.3 ),
50,
Vector3(0.47,4,0) );

[/edit]

betajaen

11-03-2006 22:47:35

Nope, Mesh shapes can't collide with each other, best to use convexShapes or shapeGroups instead.

Why would you use a mesh shape that is a sphere? The sphere Shape is a perfect sphere anyway, but:-

As for your sphere friction problem, I would do either:

- Create a separate material for the sphere, then set the friction like you did, then one for your table.

- Or set the dampening (angular and linear) to around 0.8-0.9ish

Actually this would be the better choice out of the two.

joi

12-03-2006 00:59:39

I might be wrong here, but to test it out i just chanded nxTutorial108 to be spheres instead of cubes (easy). Now when the spheres colides they stay at the same velocity forever, friction might not be working properly for spheres ? :roll:

betajaen

12-03-2006 11:07:20

I might be wrong here, but to test it out i just chanded nxTutorial108 to be spheres instead of cubes (easy). Now when the spheres colides they stay at the same velocity forever, friction might not be working properly for spheres ? :roll:

Oh it works for them but because the floor is perfectly flat, and perfectly level, and you have a perfect sphere; Friction is going to take it's time.

I find what is better is to use angular and linear dampening, which slows down the progress faster.

By default for all bodies it's 0, but raise it to 0.5 on your sphere and you'll see a difference.

[Edit]

You could try and see if it is slowing down, by checking the velocity of the sphere:



NxReal v = mySphere->mActor->getLinearVelocity().magnitude();
myDebugOverlay->setCaption(StringConverter::toString(v));


Just adjust it to your application. :D

joi

12-03-2006 15:48:23

It improved a lot! Obrigado! :wink:

betajaen

12-03-2006 18:05:18

I thought it might. :D