Project290.Physics.Dynamics.Body.GetWorldPoint C# (CSharp) Method

GetWorldPoint() public method

Get the world coordinates of a point given the local coordinates.
public GetWorldPoint ( Vector2 &localPoint ) : Vector2
localPoint Vector2 A point on the body measured relative the the body's origin.
return Vector2
        public Vector2 GetWorldPoint(ref Vector2 localPoint)
        {
            return new Vector2(Xf.Position.X + Xf.R.Col1.X*localPoint.X + Xf.R.Col2.X*localPoint.Y,
                               Xf.Position.Y + Xf.R.Col1.Y*localPoint.X + Xf.R.Col2.Y*localPoint.Y);
        }

Usage Example

Example #1
0
 /// <summary>
 /// Creates a revolute joint and adds it to the world
 /// </summary>
 /// <param name="bodyA"></param>
 /// <param name="bodyB"></param>
 /// <param name="localanchorB"></param>
 /// <returns></returns>
 public static RevoluteJoint CreateRevoluteJoint(Body bodyA, Body bodyB, Vector2 localanchorB)
 {
     Vector2 localanchorA = bodyA.GetLocalPoint(bodyB.GetWorldPoint(localanchorB));
     RevoluteJoint joint = new RevoluteJoint(bodyA, bodyB, localanchorA, localanchorB);
     return joint;
 }
All Usage Examples Of Project290.Physics.Dynamics.Body::GetWorldPoint