public void SetLocalPosition (long x, long y)
		{
			if (HasParent)
			{
				LocalPosition = Position - _parent.Position;
				LocalPosition.RotateInverse(_parent.Rotation.x,_parent.Rotation.y);
				PositionChanged = true;
			}
		}
 public void UpdateRotation()
 {
     if (HasParent)
     {
         Rotation = LocalRotation;
         Rotation.RotateInverse(_parent.Rotation.x, _parent.Rotation.y);
         RotationChanged = true;
     }
 }
 public void UpdatePosition()
 {
     if (HasParent)
     {
         Position = LocalPosition;
         Position.RotateInverse(_parent.Rotation.x, _parent.Rotation.y);
         Position       += _parent.Position;
         PositionChanged = true;
     }
 }
Exemple #4
0
        void Reset()
        {
            LSBody body = this.GetComponent <LSBody> ();

            if (body.Shape == ColliderType.Polygon)
            {
                this._points = new Vector2d[body.Vertices.Length];
                for (int i = 0; i < _points.Length; i++)
                {
                    Vector2d point = body.Vertices[i];
                    point.RotateInverse(0, FixedMath.One);
                    _points[i] = point;
                }
            }
        }
 public void SetPosition(long x, long y)
 {
     Position.x = x;
     Position.y = y;
     PositionChanged = true;
     if (HasParent)
     {
         LocalPosition = Position - _parent.Position;
         LocalPosition.RotateInverse(_parent.Rotation.x,_parent.Rotation.y);
     }
 }
Exemple #6
0
 public Vector2d TransformDirection(Vector2d worldPos)
 {
     worldPos -= _position;
     worldPos.RotateInverse(_rotation.x, _rotation.y);
     return(worldPos);
 }