Game Development Community

Yaw, Auto-Roll - Confusion

by CdnGater · in Torque Game Engine · 03/19/2007 (6:03 am) · 2 replies

Hello,

I'm at my wits end so I need someones help. I am trying to create my own SpaceVehicle based on the FlyingVehicle. Right now, its a basic copy with the gravity calculations removed.

The problem I am having is the torque does not act as I think it should. If I apply a stright yaw thrust, it turns towards the target vector but it wanders all over the place.

Now as an experiment, I commented out the Auto-Roll code, and surprise surprise, it works as expected, but unfortunetly I have no banking of the ship as it turns.

So after looking at the code some more, I see that when doing a yaw turn, with the roll enabled, the ship starts to nose dive, thus realy messing things up and making it wander.

When I look at the code, I can see what its doing. But I do not understand why (Physics is not a strong point)

// Pitch
   torque -= xv * steering.y * mDataBlock->steeringForce;

   // Yaw
   torque -= zv * steering.x * mDataBlock->steeringForce;

   // Auto Roll  (Should roll along ships axis, but its not doing it properly)
   torque += yv * steering.x * mDataBlock->steeringRollForce;
   F32 ar = mDataBlock->autoAngularForce * mDot(xv,Point3F(0,0,1));
   ar -= mDataBlock->rollForce * mDot(xv, mRigid.linVelocity);
   torque += yv * ar;

In the end, I am trying to mimic the same type of movement you see in games like Eve-Online and Freelancer.

Can someone please shed some light on this for me, or show me examples of what they did?

Thank you

#1
03/19/2007 (7:34 am)
I just relized, the torque is being applied to the vehicle coords. So when it starts to roll, the next yaw is applied while banked so that gives is the nose dive effect I am seeing.

Ok, so how do I detach them? I guess I need yaw applied to the ship's worlds angles, and the roll to the ships local angles. Next question, HOW?

Humm, ok, thinking about this more. I need Yaw and Pitch applied, so that Yaw will be adjusted though the Pitch plane only. I just need Roll applied after to the current heading. I think.
#2
03/20/2007 (1:06 pm)
Seeing as I am getting no help here, let me try a different question.

If I understand the rigid class and how its used in a vehicle properly. Any and all pitch, yaw, and rolls are applied together as one matrix to the object via a quantion.

How do I get a pitch and yaw applied to the objects world orientation, and have the roll only affect the local orientation?