world transform setup

Posted on 2006-05-05
Last Modified: 2013-12-08
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.

I’ve thought;
AcftMatrix = acftMatrix * Matrix.Translation(turningRadius,0,50.246f)  * // the acft’s axles are 50.246 units from mesh center
Matrix.RorationY(.1f) *
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).

Question by:OutsideTheBox
    LVL 3

    Author Comment

    Well, first of all, let me say thank you all for not responding. Actually I'm not being sarcastic. I was looking for a quick answer and if someone would have answered, they probably would have done much footwork for me that I needed to do to gain the experience. I feel like I just graduated matrix math school in the last 3 days. After about 12 hours of work, I got it to work properly.

    For the sake of some person doing a future search on EE, I'll briefly explain the solution I found. If anyone could offer a more elegant approach, I'm all ears.

    I use two matrix, Matrix acftMatrix; Matrix turningRadius;
    Between each frame to move the aircraft around the turning radius matrix, I use:
                    acftMatrix = acftMatrix *
                Matrix.Translation(-TrMatrix.M41, 0, -TrMatrix.M43) *
                    Matrix.Translation(TrMatrix.M41, 0, TrMatrix.M43);
                    myDevice.Transform.World = acftMatrix;
                    SetHeading(DeltaHeading);  //Updates float Heading

    and to change the point that the aircraft is pivioting around:

                TrMatrix = TrMatrix *
                Matrix.Translation(-acftMatrix.M41, 0, -acftMatrix.M43) *  
                Matrix.RotationY(-Heading) *
                Matrix.Translation(deltaTurningRadius, 0, 0) *
                Matrix.Translation(acftMatrix.M41, 0, acftMatrix.M43);

    The method to update TrMatrix is only called when the steering angle is changed, not each frame.



    Accepted Solution

    Closed, 125 points refunded.
    The Experts Exchange
    Community Support Moderator of all Ages

    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    Join & Write a Comment

    As game developers, we quickly learn that Artificial Intelligence (AI) doesn’t need to be so tough.  To reference Space Ghost: “Moltar, I have a giant brain that is able to reduce any complex machine into a simple yes or no answer. (http://www.youtu…
    Recently, in one of the tech-blogs I usually read, I saw a post about the best-selling video games through history. The first place in the list is for the classic, extremely addictive Tetris. Well, a long time ago, in a galaxy far far away, I was…
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now