2
Vote

Chase camera

description

Hi, I added code to switch the active camera on the latest sample project that acompanies your engine. Problem is that when it tracks the car, the camera appear to be rotated by 90 degrees and thus showing the left side of the car as the top part of the camera view.
 
Here's the code that I used.
 
        if (Car != null)
        {
            chase.ChaseTargetPosition = Car.Position;
            chase.ChaseTargetForward = Car.Orientation.Forward;
            chase.Up = Car.Orientation.Up;
        }
 
        if (keyboard.KeyDown(Keys.C))
        {
            if (cam is XChaseCamera)
            {
                cam = camera;
            }
            else
            {
                if (Car != null)
                {
                    cam = chase;
                }
            }
        }
 
Here's the 2 variables I use
 
    XChaseCamera chase;
    XCamera cam;
 
and in the draw code I pass the variable "cam" instead of the default that was in the sample.
 
Thanks
Q

comments