world transform setup
Posted on 2006-05-05
Using C# and directX1.1, I have a mesh object ( an aircraft) and another (tarmac). I am trying to move the aircraft around the tarmac. Taxi it.
I have done the trig to determine turning radius & have incorporated it to code. I have variables, a float called steering angle, which determines a vector3 called turningRadius ( a point that aircraft object pivots around). For now, I just want the aircraft to move 1/10th of a radian around the circle centerd on the turningRadius with a radius of the distance from aircraft to vector3 turningRadius. I’ve added code to increment or decrement the steering angle and I want to be able to drive the aircraft in varying radius circles.
My question is how to set up my world transform at aircraft render time.
AcftMatrix = acftMatrix * Matrix.Translation(turningRadius,0,50.246f) * // the acft’s axles are 50.246 units from mesh center
Matrix.Translation(-turningRadius,0,-50.246); // slew back to the new position
MyDevice.Transform.World = acftMatrix;
My thought was that I would start at my current acft position, translate to the turning radius, rotate the world, then translate back to the new position and draw the acft.
Am I on the right track here? It does screwy things and I wonder if I need to pursue this or my trig (which appears correct at this time).