Esempio n. 1
0
        public void LookAt(Vector3 position, Vector3 target, bool rotateAround)
        {
            Position = position;
            Target   = target;

            NormalZ = VectorMath.Normalize(Position - Target);
            NormalX = VectorMath.Normalize(VectorMath.Cross(new Vector3(0.0f, 1.0f, 0.0f), NormalZ));
            NormalY = VectorMath.Cross(NormalZ, NormalX);

            if (!rotateAround)
            {
                Target    = Position;
                Position += NormalZ * 0.05f;
            }

            CalculateRayMatrix();
        }