Exemple #1
0
        public void PrepareFrame(RenderFrame frame, ElapsedTime elapsedTime)
        {
            CarShape.Location.TileX = Car.TileX;
            CarShape.Location.TileZ = Car.TileZ;
            // TODO: Add 0.1f to Y to put wheels above road. Matching MSTS?
            var front  = Car.FrontLocation;
            var rear   = Car.RearLocation;
            var frontY = front.Y;
            var rearY  = rear.Y;

            if (Car.IgnoreXRotation)
            {
                frontY = frontY - RoadCar.VisualHeightAdjustment;
                rearY  = rearY - RoadCar.VisualHeightAdjustment;
                if (Math.Abs(frontY - rearY) > 0.01f)
                {
                    if (frontY > rearY)
                    {
                        rearY = frontY;
                    }
                    else
                    {
                        frontY = rearY;
                    }
                }
            }
            CarShape.Location.XNAMatrix = Simulator.XNAMatrixFromMSTSCoordinates(front.X, frontY, front.Z, rear.X, rearY, rear.Z);
            CarShape.PrepareFrame(frame, elapsedTime);
        }
Exemple #2
0
        public void PrepareFrame(RenderFrame frame, ElapsedTime elapsedTime)
        {
            CarShape.Location.TileX = Car.TileX;
            CarShape.Location.TileZ = Car.TileZ;
            // TODO: Add 0.1f to Y to put wheels above road. Matching MSTS?
            var front = Car.FrontLocation;
            var rear  = Car.RearLocation;

            CarShape.Location.XNAMatrix = Simulator.XNAMatrixFromMSTSCoordinates(front.X, front.Y, front.Z, rear.X, rear.Y, rear.Z);
            CarShape.PrepareFrame(frame, elapsedTime);
        }