continuous yaw rotation when body land on the floor

mamairaja

03-05-2010 18:11:02

Hi
Please, I need a help with matching values between terrain.cfg and NxOgre::HeightField.
Kindly tell me whether I am using correct values (based on following code and terrain.cfg)
code

NxOgre::HeightField* hf= NxOgre::HeightFieldManager::getSingleton()->load("media:TE_1.xhf");
NxOgre::HeightFieldGeometry* hfg = new NxOgre::HeightFieldGeometry(hf, NxOgre::Vec3(1500,100,1500));
hfg->setLocalPose(NxOgre::Matrix44(NxOgre::Vec3(0,100,0)));
mScene->createSceneGeometry(hfg);


terrain.cfg

DetailTile=3

PageSource=Heightmap

Heightmap.image=TE_1.png

PageSize=513

TileSize=65

MaxPixelError=3

PageWorldX=1500
PageWorldZ=1500
MaxHeight=100

MaxMipMapLevel=5

VertexProgramMorph=yes

LODMorphStart=0.2


I do not know why but I am getting a continuous yaw rotation when my body land on the floor. :(
I am using bloddymess 1.5

spacegaier

03-05-2010 18:27:09

Do you have set some friction values for the scene? If not, that could solve your issue. Just search this forum for "friction" and you should find the needed code lines.

mamairaja

05-05-2010 17:35:20

First, thank you for the reply.
I almost set the friction, but it rotates continuously ;(
honestly cannot understand where the problem is.
friction code
mScene->getMaterial(0)->setStaticFriction(0.5);
mScene->getMaterial(0)->setDynamicFriction(0.5);
mScene->getMaterial(0)->setRestitution(0.1);


And when cretae body(capsule) I raise following flags
playerPhysicsDescription.mBodyFlags |= NxOgre::Enums::BodyFlags::BodyFlags_FreezeRotationZ;
playerPhysicsDescription.mBodyFlags |= NxOgre::Enums::BodyFlags::BodyFlags_FreezeRotationX;


Could you please tell me whether my values are correct (based on height field code and terrain.cfg)?
code
NxOgre::HeightFieldGeometry* hfg = new NxOgre::HeightFieldGeometry(hf, NxOgre::Vec3(1500,100,1500));
hfg->setLocalPose(NxOgre::Matrix44(NxOgre::Vec3(0,100,0)));

terrain.cfg
PageWorldX=1500
PageWorldZ=1500
MaxHeight=100

People3d

06-05-2010 10:53:06

i think i have the same problem...
the body trumble on the floor..
i think that the problem is that the energysleeptest doesnt was abilitate...i've tried to set this to abilitate the test..but for me doesn't works...any some time the body stop and some time the body tramble...

playerPhysicsDescription.mBodyFlags |= NxOgre::Enums::BodyFlags_EnergySleepTest;

mamairaja

07-05-2010 06:21:07

hmmm....
I did some experiments.
I made some physics shapes and let them fall under gravity.
I saw that they stopped at some place above the ground.( not touching the ground).
This could be a mistake when creating the hightfiled. But I really don't know how to correct.
Let me ask my question again.
Am I wrong here when making hightfild based on terrain.cfg

NxOgre::HeightField* hf= NxOgre::HeightFieldManager::getSingleton()->load("media:TE_1.xhf");
NxOgre::HeightFieldGeometry* hfg = new NxOgre::HeightFieldGeometry(hf, NxOgre::Vec3(1500,100,1500));
hfg->setLocalPose(NxOgre::Matrix44(NxOgre::Vec3(0,100,0)));

PageWorldX=1500
PageWorldZ=1500
MaxHeight=100

please help

People3d

08-05-2010 16:19:28

hi man!
in according to Physx Documentation

Numerical considerations:
Since bodies are awakened whenever contacts are lost, actors may have a problem falling asleep when they're in a position such that numerical imprecision in the collision detection causes contacts to appear and disappear without any movement. This is not commonly a result of normal simulation, but may occur if, for example, two boxes are created with faces that exactly meet. To avoid this effect, you can create the boxes with a slight overlap, up to the skin width, which will make the contacts persistent.

to solve this u need to:
- activate the EnergySleepTest
- set the SkinWidth

People3d

09-05-2010 18:31:37

works!
http://www.youtube.com/watch?v=5vXHS46ZwzM



void PhysxManager::createBrick(NxOgre::Real p_x, NxOgre::Real p_y, NxOgre::Real p_z, NxOgre::Vec3 p_pos, Ogre::String p_mesh, NxOgre::Vec3 p_force, Ogre::Vector3 p_scale, NxOgre::Real p_mass, bool putToSleep)
{
//create Bleprint and set the mSkinWidth factor
NxOgre::ShapeBlueprint *sbp = new NxOgre::ShapeBlueprint();
sbp->mSkinWidth = 0.01;
//create shape using the shapeBlueprint
NxOgre::Box *t_shape = new NxOgre::Box(p_x, p_y, p_z, sbp);
//set RigidBody Desc
NxOgre::RigidBodyDescription t_desc = NxOgre::RigidBodyDescription();
t_desc.mBodyFlags |= NxOgre::Enums::BodyFlags_EnergySleepTest;
t_desc.mSleepEnergyThreshold = NxOgre::Real(0.1);
//create Brik
mCube = mRenderSystem->createBody(t_shape, p_pos, p_mesh,t_desc);
mCube->addForce(p_force,NxOgre::Enums::ForceMode_Impulse);
mCube->getSceneNode()->setScale(p_scale);
mCube->setMass(p_mass);
if(putToSleep)
{
//mCube->putToSleep();
}
mCube->getEntity()->setMaterialName("GameObject/Mgobbo");
}