Earthquake!!!!!

Nightwalker

28-03-2007 13:40:58

Hi OgreNewt community! :wink:

I am with a problem.
My person to walk (using body->setVelocity) it is tremendous.
He seems that it is in an earthquake.

Somebody knows as to fix? :?:

Game_Ender

28-03-2007 17:26:31

Don't use setVelocity besides when you first create the person. Apply forces and torques to the person to move them.

EDIT: Don't use setVelocity *except* when you first create ...

CagedFury

28-03-2007 19:49:20

Sounds imilar to the problem im having, but i am using forces. If you press F3 is it the collision body you are moving around vibrating which is making your character mesh vibrate?

Nightwalker

28-03-2007 21:33:51

Hi!

I changed setVelocity for addForce, but he continues, person is tremendous.

Looks my code:


void Player::move (typeOrientation orient) {

Real desvio = 0; // South

if (orient == EAST) desvio = 90;
else if (orient == NORTH) desvio = 180;
else if (orient == WEST) desvio = -90;

Real rot = Degree(rotYcam).valueRadians(); //rotYcam == Rotation Camera

bForce.x = Math::Sin(rot) * force_power;
bForce.z = Math::Cos(rot) * force_power;
}





void Player::forceCallback( OgreNewt::Body* me ) {
Player* camPlayer = (RafaelAllPlayers*) me->getUserData();
Real mass;
Vector3 inertia;

me->getMassMatrix(mass, inertia);

me->setForce( bForce * mass );
me->setOmega(Vector3::ZERO);
}



Somebody does not have an example of open source that person shows one walking without trembling?


:!:

CagedFury

28-03-2007 23:39:54

Where is your camera placed? and how does the camera follow your character?

Also just curious as to why you are multiplying yor force by mass? (surely just multiply gravity force by mass)

Otherwise as far a si can see it should work fine although i dont understand the orientation stuff i can only assume that the problem is similar to the one ive been jossling with for the entire day which came down to the camera.