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);
}
/// <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; }