Problem* Shaky physics & weird wheel

elitic

02-12-2009 00:35:03

Hello everyone, The problem is that physics are shaking with no reason.
This is happening in my game project and while using wiki tutorial (http://www.ogre3d.org/wiki/index.php/BloodyMess_Tutorial_3_Source).
To achieve shaking effect I just copy tutorial 3 code and add such lines:
for (int a=1;a<=5;a++)
{
mRenderSystem->createBody(new NxOgre::Box(1, 1, 1), NxOgre::Vec3(10, a, 10), "cube.1m.mesh");
}

Also comment out:
//mCube = mRenderSystem->createBody(new NxOgre::Box(1, 1, 1), NxOgre::Vec3(0, 40, 0), "cube.1m.mesh");
//mCubeTwo = mRenderSystem->createBody(new NxOgre::Box(1, 1, 1), NxOgre::Vec3(20, 45, 0), "cube.1m.mesh");
//mCubeTwo->addForce(NxOgre::Vec3(-800, -200, 0), NxOgre::Enums::ForceMode_Force, true);

And the result is: (YouTube Video showing this problem)


Another problem is when I try to add custom „wheel“, code:
NxOgre::ResourceSystem::getSingleton()->openArchive("media", "file:media");
mRenderSystem->createBody(new NxOgre::Convex( NxOgre::MeshManager::getSingleton()->load("media:wheel_shape.nxs") ), NxOgre::Vec3(0,50,10),"wheel_shape.mesh");

The „wheel“ is acting weirdly... : (Another YouTube video)

Debug build isn't problem, because release build has same „effect“.
I think both problems are from same source, but I have no Idea how to fix them...

klarax

08-12-2009 14:29:06

Hey,

I'm not a pro or anything but to me, in the first video the boxes look as though the top box don't appear to have one of them visual debug circular things around them. shouldn't there be? And, the other boxes visual circles are all intersecting the others, kinda like they dont have box boundings but circluar ones. Although not sure about this at all.

As for the second video, i pretty sure its down to a simular thing. If you notice, the wheel appears to have a box as a bounding area, and a small section of the wheel is sticking through it. And where is lands its hits the both of them (bounding box and mesh wheel), so it hits the wheel bit, then moves to hit the box and repeats... so it gives a rocking motion. To stop the rocking, when motion is less than an certain amount, maybe stop the wheel force. I forget the func for that atm soz.

To get the wheel acting correctly and like a wheel. Look into the tutorial on meshes and resoruces i think its called. Where you load in nxs files as triangle and convex types. Much better results :)

hope all that makes sense..... :P

Klarax

elitic

08-12-2009 21:01:22

Thank you very much for reply :D
I found out that I needed to set linear damping to every object...

for (int a=1;a<=5;a++)
{
OGRE3DBody* nxbox = mRenderSystem->createBody(new NxOgre::Box(1, 1, 1), NxOgre::Vec3(10, a, 10), "cube.1m.mesh");
nxbox->setLinearDamping(0.5);
}

And there were no more shaky problem...

Also I have found out that PhysX don't support cylinder shape... :x That's the main reason I won't be using PhysX anymore... I'll consider whether to choose Newton physics or Havok. :?

Elitic

betajaen

08-12-2009 22:25:41

If your doing wheels then you should use the wheel shape which is optimised for that sort of thing and includes a motor system for torque control, otherwise you can use a capsule.