Exemplo n.º 1
0
        protected Vector3 GetTranslation()
        {
            var mTranslation = new Vector3(0, 0, 0);

            mTranslation.z = State.InputManger.IsKeyDown(KeyCode.KC_W)  ? -TRANSLATE : mTranslation.z;
            mTranslation.z = State.InputManger.IsKeyDown(KeyCode.KC_S) ? TRANSLATE : mTranslation.z;
            mTranslation.y = State.InputManger.IsKeyDown(KeyCode.KC_Q) ? -TRANSLATE : mTranslation.y;
            mTranslation.y = State.InputManger.IsKeyDown(KeyCode.KC_E) ? TRANSLATE : mTranslation.y;
            mTranslation.x = State.InputManger.IsKeyDown(KeyCode.KC_A) ? -TRANSLATE : mTranslation.x;
            mTranslation.x = State.InputManger.IsKeyDown(KeyCode.KC_D) ? TRANSLATE : mTranslation.x;

            if (State.InputManger.InputJoyStick != null && mTranslation.Equals(new Vector3()))
            {
                mTranslation = TranslateJoystick();
            }

            return(mTranslation);
        }
Exemplo n.º 2
0
        protected Vector3 GetTranslation()
        {
            var mTranslation = new Vector3(0, 0, 0);

            mTranslation.z = State.InputManger.IsKeyDown(KeyCode.KC_W)  ? -TRANSLATE : mTranslation.z;
            mTranslation.z = State.InputManger.IsKeyDown(KeyCode.KC_S) ? TRANSLATE : mTranslation.z;
            mTranslation.y = State.InputManger.IsKeyDown(KeyCode.KC_Q) ? -TRANSLATE : mTranslation.y;
            mTranslation.y = State.InputManger.IsKeyDown(KeyCode.KC_E) ? TRANSLATE : mTranslation.y;
            mTranslation.x = State.InputManger.IsKeyDown(KeyCode.KC_A) ? -TRANSLATE : mTranslation.x;
            mTranslation.x = State.InputManger.IsKeyDown(KeyCode.KC_D) ? TRANSLATE : mTranslation.x;

            if (State.InputManger.InputJoyStick != null && mTranslation.Equals(new Vector3()))
                    mTranslation = TranslateJoystick();

            return mTranslation;
        }
Exemplo n.º 3
0
 /// <summary>
 /// Returns a boolean indicating whether the given Box is equal to this Box instance.
 /// </summary>
 /// <param name="other">The Box to compare this instance to.</param>
 /// <returns>True if the other Box is equal to this instance; False otherwise.</returns>
 public bool Equals(ref Aabb other)
 {
     return
         (Center.Equals(other.Center) &&
          HalfSize.Equals(other.HalfSize));
 }
Exemplo n.º 4
0
 /// <summary>
 /// Returns a boolean indicating whether the given Sphere is equal to this Sphere instance.
 /// </summary>
 /// <param name="other">The Sphere to compare this instance to.</param>
 /// <returns>True if the other Sphere is equal to this instance; False otherwise.</returns>
 public bool Equals(ref Sphere other)
 {
     return
         (Center.Equals(ref other.Center) &&
          Radius == other.Radius);
 }
Exemplo n.º 5
0
        /// <summary>Tests whether this ray intersects the given plane. A pair structure where the first element indicates whether an intersection occurs, and if true, the second element will indicate the distance along the ray at which it intersects. This can be converted to a point in space by calling getPoint(). </summary>
        //public Pair<bool, float> Intersects(PlaneBoundedVolume p)
        //{
        //    byte normalIsOutside;
        //    if (p.outside == Plane.Side.POSITIVE_SIDE)
        //    {
        //        normalIsOutside = 1;
        //    }
        //    else
        //    {
        //        normalIsOutside = 0;
        //    }
        //    return Math.Intersects(this, p.planes, normalIsOutside != 0);
        //}

        /// <summary>
        /// Returns a boolean indicating whether the given Ray is equal to this Ray instance.
        /// </summary>
        /// <param name="other">The Ray to compare this instance to.</param>
        /// <returns>True if the other Ray is equal to this instance; False otherwise.</returns>
        public bool Equals(ref Ray other)
        {
            return
                (Origin.Equals(ref other.Origin) &&
                 Direction.Equals(other.Direction));
        }