예제 #1
0
        public static bool IsPerpendicular(Vector3D a, Vector3D b)
        {
            var coordsA = a;
            var coordsB = b;

            return(Vector3D.ArePerpendicular(ref a, ref b));
        }
예제 #2
0
        public void AssignInitialMatrix(MatrixD initialMatrix)
        {
            var position = initialMatrix.Translation;
            var forward  = initialMatrix.Forward;
            var up       = initialMatrix.Up;

            if (CustomRelativeForward != Direction.None)
            {
                forward = GetDirectionFromMatrixAndEnum(initialMatrix, CustomRelativeForward);
            }

            if (CustomRelativeUp != Direction.None)
            {
                up = GetDirectionFromMatrixAndEnum(initialMatrix, CustomRelativeUp);
            }

            if (Vector3D.ArePerpendicular(ref forward, ref up))
            {
                CurrentPositionMatrix = MatrixD.CreateWorld(position, forward, up);
            }
            else
            {
                CurrentPositionMatrix = initialMatrix;
                Logger.MsgDebug(string.Format("Warning: Custom Spawn Directions [{0}] and [{1}] are not perpendicular. Using default directions instead", CustomRelativeForward, CustomRelativeUp), DebugTypeEnum.Spawn);
            }
        }