Ejemplo n.º 1
0
        public Vector2d Rotated(long cos, long sin)
        {
            Vector2d vec = this;

            vec.Rotate(cos, sin);
            return(vec);
        }
Ejemplo n.º 2
0
 public void UpdateLocalRotation()
 {
     if (HasParent)
     {
         LocalRotation = Rotation;
         LocalRotation.Rotate(_parent.Rotation.x, _parent.Rotation.y);
     }
 }
Ejemplo n.º 3
0
 public void UpdateLocalPosition()
 {
     if (HasParent)
     {
         LocalPosition = Position - _parent.Position;
         LocalPosition.Rotate(_parent.Rotation.x, _parent.Rotation.y);
     }
 }
Ejemplo n.º 4
0
 public void Rotate(long cos, long sin)
 {
     if (HasParent)
     {
         LocalRotation.Rotate(cos, sin);
     }
     else
     {
         Rotation.Rotate(cos, sin);
     }
     RotationChanged = true;
 }
Ejemplo n.º 5
0
		public void Simulate ()
		{
			if (HasParent)
			{
				if (_parent.RotationChangedBuffer)
				{
					Position = LocalPosition;
					Position.Rotate (_parent.Rotation.x,_parent.Rotation.y);
					Position += _parent.Position;

					Rotation = LocalRotation;
					Rotation.Rotate (_parent.Rotation.x,_parent.Rotation.y);
					RotationChanged = true;
					PositionChanged = true;
				}
				else if (_parent.PositionChangedBuffer) {
					Position += _parent.Offset;
					PositionChanged = true;
				}
			}
			if (PositionChanged || RotationChanged) {
				if (PositionChanged) {
					FuturePosition.x = Position.x + Velocity.x * PhysicsManager.ColSpreadMul;
					FuturePosition.y = Position.y + Velocity.y * PhysicsManager.ColSpreadMul;
					SetPositionBuffer = true;
				} else {

				}

				if (RotationChanged) {
					SetRotationBuffer = true;
				} else {
				}

				BuildPoints ();
				BuildBounds ();

				PositionChanged = false;
				RotationChanged = false;
			} else {

			}
		}
Ejemplo n.º 6
0
 public void Rotate(long cos, long sin)
 {
     _rotation.Rotate(cos, sin);
     RotationChanged = true;
 }
Ejemplo n.º 7
0
        public void Simulate()
        {
            if (HasParent)
            {
                if (_parent.RotationChangedBuffer)
                {
                    Position = LocalPosition;
                    Position.Rotate (_parent.Rotation.x,_parent.Rotation.y);
                    Position += _parent.Position;

                    Rotation = LocalRotation;
                    Rotation.Rotate (_parent.Rotation.x,_parent.Rotation.y);
                    RotationChanged = true;
                    PositionChanged = true;
                }
                else if (_parent.PositionChangedBuffer) {
                    Position += _parent.Offset;
                    PositionChanged = true;
                }
            }
            if (PositionChanged || RotationChanged) {
                if (PositionChanged) {
                    FuturePosition.x = Position.x + Velocity.x * PhysicsManager.ColSpreadMul;
                    FuturePosition.y = Position.y + Velocity.y * PhysicsManager.ColSpreadMul;
                    SetPositionBuffer = true;
                } else {

                }

                if (RotationChanged) {
                    SetRotationBuffer = true;
                } else {
                }

                BuildPoints ();
                BuildBounds ();

                PositionChanged = false;
                RotationChanged = false;
            } else {

            }
        }
Ejemplo n.º 8
0
 public Vector2d InverseTransformDirection(Vector2d localPos)
 {
     localPos.Rotate(_rotation.x, _rotation.y);
     localPos += _position;
     return(localPos);
 }