Example #1
0
 public static void ParentToSlot(GameObject obj, Slot slot, GameObject parent)
 {
     if (obj != null && parent != null)
     {
         obj.SetPosition(parent.GetPositionOfSlot(slot));
         obj.SetForward(parent.GetForwardOfSlot(slot));
         obj.ParentToSlot(parent, slot);
     }
 }
        internal static void TurnLeft(GameObject sim)
        {
            Vector3 newForward = Quaternion.MakeFromEulerAngles(0f, ANGLE_315, 0f).ToMatrix().TransformVector(sim.ForwardVector);

            sim.SetForward(newForward);

            //Quaternion q = Quaternion.MakeFromEulerAngles(0, ANGLE_45, 0);
            //Vector3 newForward = (q * sim.ForwardVector).Vector;
            //sim.SetForward(newForward);
        }
Example #3
0
        public static void TurnRight(GameObject gameObject)
        {
            Vector3 forward = Quaternion.MakeFromEulerAngles(0f, ANGLE_90, 0f).ToMatrix().TransformVector(gameObject.ForwardVector);

            if (forward == Vector3.Empty)
            {
                return;
            }
            gameObject.SetForward(forward);
        }
Example #4
0
        public static void Tilt(GameObject gameObject, float x, float y, float z)
        {
            Vector3 forward = new Vector3(x, y, z).Normalize();

            if (forward == Vector3.Empty)
            {
                return;
            }
            gameObject.SetForward(forward);
        }
Example #5
0
        public static void TurnAround(GameObject gameObject)
        {
            var     f       = gameObject.ForwardVector;
            Vector3 forward = new Vector3(0f - f.x, f.y, 0f - f.z);

            if (forward == Vector3.Empty)
            {
                return;
            }
            gameObject.SetForward(forward);
        }
        public static void RemoveMoveInteractions(GameObject gameObject, bool resetLocation)
        {
            if (MovedObjects.ContainsKey(gameObject))
            {
                if (resetLocation)
                {
                    LocationVectors vectors;
                    if (MovedObjects.TryGetValue(gameObject, out vectors))
                    {
                        gameObject.SetForward(vectors.ForwardVector);
                        gameObject.SetPosition(vectors.Position);
                    }
                }
                MovedObjects.Remove(gameObject);
            }
            gameObject.RemoveInteractionByType(StopMovingMe.Singleton);

            gameObject.RemoveInteractionByType(TurnLeft.Singleton);
            gameObject.RemoveInteractionByType(TurnAtAngle.Singleton);
            gameObject.RemoveInteractionByType(TurnRight.Singleton);
            gameObject.RemoveInteractionByType(TurnAround.Singleton);
            gameObject.RemoveInteractionByType(TiltFaceUp.Singleton);
            gameObject.RemoveInteractionByType(TiltBack.Singleton);
            gameObject.RemoveInteractionByType(TiltForward.Singleton);
            gameObject.RemoveInteractionByType(TiltFaceDown.Singleton);
            gameObject.RemoveInteractionByType(TiltUserDefined.Singleton);

            gameObject.RemoveInteractionByType(MoveUp.Singleton);
            gameObject.RemoveInteractionByType(MoveUpUserDefined.Singleton);
            gameObject.RemoveInteractionByType(MoveDown.Singleton);
            gameObject.RemoveInteractionByType(MoveDownUserDefined.Singleton);
            gameObject.RemoveInteractionByType(MoveBack.Singleton);
            gameObject.RemoveInteractionByType(MoveBackUserDefined.Singleton);
            gameObject.RemoveInteractionByType(MoveForward.Singleton);
            gameObject.RemoveInteractionByType(MoveForwardUserDefined.Singleton);

            gameObject.RemoveInteractionByType(MoveRight.Singleton);
            gameObject.RemoveInteractionByType(MoveRightUserDefined.Singleton);
            gameObject.RemoveInteractionByType(MoveLeft.Singleton);
            gameObject.RemoveInteractionByType(MoveLeftUserDefined.Singleton);
        }
 internal static void TurnAround(GameObject sim)
 {
     Vector3 newForward = new Vector3(-sim.ForwardVector.x, sim.ForwardVector.y, -sim.ForwardVector.z);
     sim.SetForward(newForward);
 }
 internal static void Tilt(GameObject sim, float x, float y, float z)
 {
     Vector3 newForward = new Vector3(x, y, z).Normalize();
     sim.SetForward(newForward);
 }
 internal static void TurnRight(GameObject sim)
 {
     Vector3 newForward = Quaternion.MakeFromEulerAngles(0f, ANGLE_90, 0f).ToMatrix().TransformVector(sim.ForwardVector);
     sim.SetForward(newForward);
 }
        internal static void TurnLeft(GameObject sim)
        {
            Vector3 newForward = Quaternion.MakeFromEulerAngles(0f, ANGLE_315, 0f).ToMatrix().TransformVector(sim.ForwardVector);
            sim.SetForward(newForward);

            //Quaternion q = Quaternion.MakeFromEulerAngles(0, ANGLE_45, 0);
            //Vector3 newForward = (q * sim.ForwardVector).Vector;
            //sim.SetForward(newForward);
        }
Example #11
0
 public static void ParentToSlot(GameObject obj, Slot slot, GameObject parent)
 {
     if (obj != null && parent != null)
     {
         obj.SetPosition(parent.GetPositionOfSlot(slot));
         obj.SetForward(parent.GetForwardOfSlot(slot));                
         obj.ParentToSlot(parent, slot);                
     }
 }
        internal static void TurnAround(GameObject sim)
        {
            Vector3 newForward = new Vector3(-sim.ForwardVector.x, sim.ForwardVector.y, -sim.ForwardVector.z);

            sim.SetForward(newForward);
        }
        internal static void TurnRight(GameObject sim)
        {
            Vector3 newForward = Quaternion.MakeFromEulerAngles(0f, ANGLE_90, 0f).ToMatrix().TransformVector(sim.ForwardVector);

            sim.SetForward(newForward);
        }
        internal static void Tilt(GameObject sim, float x, float y, float z)
        {
            Vector3 newForward = new Vector3(x, y, z).Normalize();

            sim.SetForward(newForward);
        }
        public static void RemoveMoveInteractions(GameObject gameObject, bool resetLocation)
        {
            if (MovedObjects.ContainsKey(gameObject))
            {
                if (resetLocation)
                {
                    LocationVectors vectors;
                    if (MovedObjects.TryGetValue(gameObject, out vectors))
                    {
                        gameObject.SetForward(vectors.ForwardVector);
                        gameObject.SetPosition(vectors.Position);
                    }
                }
                MovedObjects.Remove(gameObject);
            }
            gameObject.RemoveInteractionByType(StopMovingMe.Singleton);

            gameObject.RemoveInteractionByType(TurnLeft.Singleton);
            gameObject.RemoveInteractionByType(TurnAtAngle.Singleton);
            gameObject.RemoveInteractionByType(TurnRight.Singleton);
            gameObject.RemoveInteractionByType(TurnAround.Singleton);
            gameObject.RemoveInteractionByType(TiltFaceUp.Singleton);
            gameObject.RemoveInteractionByType(TiltBack.Singleton);
            gameObject.RemoveInteractionByType(TiltForward.Singleton);
            gameObject.RemoveInteractionByType(TiltFaceDown.Singleton);
            gameObject.RemoveInteractionByType(TiltUserDefined.Singleton);

            gameObject.RemoveInteractionByType(MoveUp.Singleton);
            gameObject.RemoveInteractionByType(MoveUpUserDefined.Singleton);
            gameObject.RemoveInteractionByType(MoveDown.Singleton);
            gameObject.RemoveInteractionByType(MoveDownUserDefined.Singleton);
            gameObject.RemoveInteractionByType(MoveBack.Singleton);
            gameObject.RemoveInteractionByType(MoveBackUserDefined.Singleton);
            gameObject.RemoveInteractionByType(MoveForward.Singleton);
            gameObject.RemoveInteractionByType(MoveForwardUserDefined.Singleton);

            gameObject.RemoveInteractionByType(MoveRight.Singleton);
            gameObject.RemoveInteractionByType(MoveRightUserDefined.Singleton);
            gameObject.RemoveInteractionByType(MoveLeft.Singleton);
            gameObject.RemoveInteractionByType(MoveLeftUserDefined.Singleton);
        }