Beispiel #1
0
        public override void UpdateViewMatrix()
        {
            if (Beta < MinBeta)
            {
                Beta = MinBeta;
            }

            var sideRadius = Radius * Beta.Cos();
            var height     = Radius * Beta.Sin();

            if (Target.Y + height < MinY)
            {
                height = MinY - Target.Y;
            }

            Position = new Vector3(
                Target.X + sideRadius * Alpha.Cos(),
                Target.Y + height,
                Target.Z + sideRadius * Alpha.Sin());
            SetView(Matrix.LookAtRH(Position, Target, GetUpTilt(Target, Vector3.UnitY)));

            Right = new Vector3(View.M11, View.M21, View.M31);
            Right.Normalize();

            Up = new Vector3(View.M12, View.M22, View.M32);
            Up.Normalize();

            Look = -new Vector3(View.M13, View.M23, View.M33);
            Look.Normalize();
        }