l34ndr4
09-03-2006 12:22:04
Hi, we have a big problem
moving the a character with forces.
we are making an FPS character , so the character should
stop when the key is released.
we have read all about inverse dynamics in the newton forums
and everywhere but it doesnt work (for us) :S
the player moves right but the aceleration decrements slowly.
this is our code in the forcecallback.
Real desiredVelocity = 0.001;
Vector3 V0 = me->getVelocity();
Vector3 V1=player->getVectorDirection()*player->getVectorDirection().normalise();
V1=V1*desiredVelocity;
Vector3 acel ((V1 - V0) / 1);
acel = acel * 0.3f;
Vector3 force = Vector3(acel.x,-9.8,acel.z)/1000 * mass;
me->addForce(force);
//explanation
we are just passing this newton code to ogrenewt
http://www.physicsengine.com/forum/viewtopic.php?t=342
the / 1 its because we are just assuming that every time it is called it has pass a second.
the /1000 its because the resulting aceleration its to big so we have to narrow it down.
the getVectorDirection() function just gives us the player direction * camera orientation.
pls can someone tell me whats wrong with my code.
thx in advance.
btw:: my friction between the 2 materials is 0,0 or BIG#,BIG# and really havent seen much difference.
moving the a character with forces.
we are making an FPS character , so the character should
stop when the key is released.
we have read all about inverse dynamics in the newton forums
and everywhere but it doesnt work (for us) :S
the player moves right but the aceleration decrements slowly.
this is our code in the forcecallback.
Real desiredVelocity = 0.001;
Vector3 V0 = me->getVelocity();
Vector3 V1=player->getVectorDirection()*player->getVectorDirection().normalise();
V1=V1*desiredVelocity;
Vector3 acel ((V1 - V0) / 1);
acel = acel * 0.3f;
Vector3 force = Vector3(acel.x,-9.8,acel.z)/1000 * mass;
me->addForce(force);
//explanation
we are just passing this newton code to ogrenewt
http://www.physicsengine.com/forum/viewtopic.php?t=342
the / 1 its because we are just assuming that every time it is called it has pass a second.
the /1000 its because the resulting aceleration its to big so we have to narrow it down.
the getVectorDirection() function just gives us the player direction * camera orientation.
pls can someone tell me whats wrong with my code.
thx in advance.
btw:: my friction between the 2 materials is 0,0 or BIG#,BIG# and really havent seen much difference.