Exemplo n.º 1
0
        public override void Rotate(Vector3 axis, float angle)
        {
            Quaternion rot = Orientation;

            GameComponentHelper.Rotate(axis, angle, ref rot);
            Orientation = rot;
        }
Exemplo n.º 2
0
        public static void LockRotation(ref Quaternion rotation, Vector3 lockedRots)
        {
            lockedRots -= -Vector3.One;
            Vector3 rots = GameComponentHelper.QuaternionToEulerAngleVector3(rotation) * lockedRots;

            rotation = Quaternion.CreateFromRotationMatrix(Matrix.CreateRotationX(rots.X) * Matrix.CreateRotationY(rots.Y) * Matrix.CreateRotationX(rots.Z));
        }
Exemplo n.º 3
0
        /// <summary>
        /// Method to revolve and object
        /// </summary>
        /// <param name="target"></param>
        /// <param name="axis"></param>
        /// <param name="angle"></param>
        /// <param name="position"></param>
        /// <param name="rotation"></param>
        public static void Revolve(Vector3 target, Vector3 axis, float angle, ref Vector3 position, ref Quaternion rotation)
        {
            GameComponentHelper.Rotate(axis, angle, ref rotation);
            Vector3    revolveAxis = Vector3.Transform(axis, Matrix.CreateFromQuaternion(rotation));
            Quaternion rotate      = Quaternion.CreateFromAxisAngle(revolveAxis, angle);

            position = Vector3.Transform(target - position, Matrix.CreateFromQuaternion(rotate));
        }
Exemplo n.º 4
0
 public override void DumpDebugInfo(StringBuilder stringBuilder)
 {
     base.DumpDebugInfo(stringBuilder);
     stringBuilder.AppendFormat("BulletXNAObject type[{0}] actiState[{1}] mask[{2}] flags[{3}]", RigidBody != null?"RB":"G", CollisionObject.GetActivationState(), CollisionMask, CollisionGroups);
     GameComponentHelper.PrintVector3(stringBuilder, "LinVel", LinearVelocity);
     if (CollisionObject.GetBroadphaseHandle() != null)
     {
         GameComponentHelper.PrintVector3(stringBuilder, "aaBMin", CollisionObject.GetBroadphaseHandle().m_aabbMin);
         GameComponentHelper.PrintVector3(stringBuilder, "aaBMax", CollisionObject.GetBroadphaseHandle().m_aabbMax);
     }
 }
Exemplo n.º 5
0
        public override void Rotate(Vector3 axis, float angle)
        {
            callCount++;
            if (callCount == 1 || callCount == 2)
            {
                Matrix     m  = RigidBody.WorldTransform;
                Quaternion q  = Quaternion.CreateFromRotationMatrix(m);
                Quaternion qc = q;
                GameComponentHelper.Rotate(axis, angle, ref q);
                int ibreak = 0;
            }
            rotation = Quaternion.CreateFromRotationMatrix(RigidBody.WorldTransform);
            GameComponentHelper.Rotate(axis, angle, ref rotation);
            Matrix result = Matrix.CreateFromQuaternion(rotation) * Matrix.CreateTranslation(Position);

            RigidBody.WorldTransform = result;

            System.Console.WriteLine("RotResult : " + result);
            // nb scale doesn't really count here as it will be the collisionshape not the rigid body that counts?
        }
Exemplo n.º 6
0
 public virtual void DumpDebugInfo(StringBuilder stringBuilder)
 {
     stringBuilder.AppendLine("BaseDeferredObject [" + this.GetType() + "][" + m_debugId + "]");
     stringBuilder.AppendFormat("Enabled[{0}] Visible[{1}] Mesh[{2}]\n", Enabled, Visible, Mesh);
     GameComponentHelper.PrintMatrix(stringBuilder, "World", World);
 }
Exemplo n.º 7
0
 public virtual void RotateAA(Vector3 axis, float angle)
 {
     GameComponentHelper.RotateAA(axis, angle, ref rotation);
 }
Exemplo n.º 8
0
 public virtual void TranslateOO(Vector3 distance)
 {
     HasMoved  = Moved(distance);
     position += GameComponentHelper.Translate3D(distance, rotation);
 }
Exemplo n.º 9
0
 public virtual void TranslateAA(Vector3 distance)
 {
     Position += GameComponentHelper.Translate3D(distance);
 }
Exemplo n.º 10
0
 public virtual void LookAtLockRotation(Vector3 target, float speed, Vector3 fwd, Vector3 lockedRots)
 {
     GameComponentHelper.LookAtLockRotation(target, speed, Position, ref rotation, fwd, lockedRots);
 }
Exemplo n.º 11
0
 /// <summary>
 /// Method to turn the camera at a target.
 /// </summary>
 /// <param name="target"></param>
 /// <param name="speed"></param>
 public virtual void LookAt(Vector3 target, float speed, Vector3 fwd)
 {
     GameComponentHelper.LookAt(target, speed, Position, ref rotation, fwd);
 }
Exemplo n.º 12
0
 public override void TranslateOO(Vector3 distance)
 {
     HasMoved = Moved(distance);
     CollisionObject.SetActivationState(ActivationState.ACTIVE_TAG);
     CollisionObject.Translate(GameComponentHelper.Translate3D(distance, rotation));
 }
Exemplo n.º 13
0
 public override void TranslateOO(Vector3 distance)
 {
     HasMoved = Moved(distance);
     RigidBody.ActivationState = BulletSharpPhysics.ActivationState.ActiveTag;
     RigidBody.Translate(GameComponentHelper.Translate3D(distance, rotation));
 }
Exemplo n.º 14
0
 public void TranslateAA(Vector3 distance)
 {
     HasMoved  = Moved(distance);
     Position += GameComponentHelper.Translate3D(distance);
 }
Exemplo n.º 15
0
 /// <summary>
 /// Method to rotate object
 /// </summary>
 /// <param name="axis"></param>
 /// <param name="angle"></param>
 public void Rotate(Vector3 axis, float angle)
 {
     GameComponentHelper.Rotate(axis, angle, ref Rotation);
 }