GetLocalPoint() public method

Gets a local point relative to the body's origin given a world point.
public GetLocalPoint ( System.Vector2 worldPoint ) : System.Vector2
worldPoint System.Vector2 A point in world coordinates.
return System.Vector2
 /// <summary>
 /// Initialize the bodies, anchors, and reference angle using the world
 /// anchor.
 /// </summary>
 public void Initialize(Body body1, Body body2, Vector2 anchor)
 {
     Body1          = body1;
     Body2          = body2;
     LocalAnchor1   = body1.GetLocalPoint(anchor);
     LocalAnchor2   = body2.GetLocalPoint(anchor);
     ReferenceAngle = body2.GetAngle() - body1.GetAngle();
 }
Ejemplo n.º 2
0
 public void Initialize(Body body1, Body body2, Vec2 anchor1, Vec2 anchor2)
 {
     this.Body1        = body1;
     this.Body2        = body2;
     this.LocalAnchor1 = body1.GetLocalPoint(anchor1);
     this.LocalAnchor2 = body2.GetLocalPoint(anchor2);
     this.Length       = (anchor2 - anchor1).Length();
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Initialize the bodies, anchors, axis, and reference angle using the world
 /// anchor and world axis.
 /// </summary>
 public void Initialize(Body body1, Body body2, Vector2 anchor, Vector2 axis)
 {
     Body1        = body1;
     Body2        = body2;
     localAnchor1 = body1.GetLocalPoint(anchor);
     localAnchor2 = body2.GetLocalPoint(anchor);
     localAxis1   = body1.GetLocalVector(axis);
 }
Ejemplo n.º 4
0
 public void Initialize(Body body1, Body body2, Vec2 anchor)
 {
     this.Body1 = body1;
     this.Body2 = body2;
     this.LocalAnchor1 = body1.GetLocalPoint(anchor);
     this.LocalAnchor2 = body2.GetLocalPoint(anchor);
     this.ReferenceAngle = body2.GetAngle() - body1.GetAngle();
 }
Ejemplo n.º 5
0
 public void Initialize(Body body1, Body body2, Vec2 anchor)
 {
     this.Body1          = body1;
     this.Body2          = body2;
     this.LocalAnchor1   = body1.GetLocalPoint(anchor);
     this.LocalAnchor2   = body2.GetLocalPoint(anchor);
     this.ReferenceAngle = body2.GetAngle() - body1.GetAngle();
 }
Ejemplo n.º 6
0
 public void Initialize(Body body1, Body body2, Vec2 anchor, Vec2 axis)
 {
     this.Body1 = body1;
     this.Body2 = body2;
     this.localAnchor1 = body1.GetLocalPoint(anchor);
     this.localAnchor2 = body2.GetLocalPoint(anchor);
     this.localAxis1 = body1.GetLocalVector(axis);
 }
Ejemplo n.º 7
0
 public void Initialize(Body body1, Body body2, Vec2 anchor1, Vec2 anchor2)
 {
     this.Body1 = body1;
     this.Body2 = body2;
     this.LocalAnchor1 = body1.GetLocalPoint(anchor1);
     this.LocalAnchor2 = body2.GetLocalPoint(anchor2);
     this.Length = (anchor2 - anchor1).Length();
 }
Ejemplo n.º 8
0
		/// <summary>
		/// Initialize the bodies, anchors, and length using the world anchors.
		/// </summary>
		public void Initialize(Body body1, Body body2, Vec2 anchor1, Vec2 anchor2)
		{
			Body1 = body1;
			Body2 = body2;
			LocalAnchor1 = body1.GetLocalPoint(anchor1);
			LocalAnchor2 = body2.GetLocalPoint(anchor2);
			Vec2 d = anchor2 - anchor1;
			Length = d.Length();
		}
Ejemplo n.º 9
0
        /// <summary>
        /// Initialize the bodies, anchors, and length using the world anchors.
        /// </summary>
        public void Initialize(Body body1, Body body2, Vector2 anchor1, Vector2 anchor2)
        {
            Body1        = body1;
            Body2        = body2;
            LocalAnchor1 = body1.GetLocalPoint(anchor1);
            LocalAnchor2 = body2.GetLocalPoint(anchor2);
            Vector2 d = anchor2 - anchor1;

            Length = d.magnitude;
        }
Ejemplo n.º 10
0
 public void Initialize(Body body1, Body body2, Vec2 groundAnchor1, Vec2 groundAnchor2, Vec2 anchor1, Vec2 anchor2, float ratio)
 {
     this.Body1 = body1;
     this.Body2 = body2;
     this.GroundAnchor1 = groundAnchor1;
     this.GroundAnchor2 = groundAnchor2;
     this.LocalAnchor1 = body1.GetLocalPoint(anchor1);
     this.LocalAnchor2 = body2.GetLocalPoint(anchor2);
     this.Length1 = (anchor1 - groundAnchor1).Length();
     this.Length2 = (anchor2 - groundAnchor2).Length();
     this.Ratio = ratio;
     Box2DXDebug.Assert(ratio > Settings.FLT_EPSILON);
     float num = this.Length1 + ratio * this.Length2;
     this.MaxLength1 = num - ratio * PulleyJoint.MinPulleyLength;
     this.MaxLength2 = (num - PulleyJoint.MinPulleyLength) / ratio;
 }
Ejemplo n.º 11
0
        public void Initialize(Body body1, Body body2, Vec2 groundAnchor1, Vec2 groundAnchor2, Vec2 anchor1, Vec2 anchor2, float ratio)
        {
            this.Body1         = body1;
            this.Body2         = body2;
            this.GroundAnchor1 = groundAnchor1;
            this.GroundAnchor2 = groundAnchor2;
            this.LocalAnchor1  = body1.GetLocalPoint(anchor1);
            this.LocalAnchor2  = body2.GetLocalPoint(anchor2);
            this.Length1       = (anchor1 - groundAnchor1).Length();
            this.Length2       = (anchor2 - groundAnchor2).Length();
            this.Ratio         = ratio;
            Box2DXDebug.Assert(ratio > Settings.FLT_EPSILON);
            float num = this.Length1 + ratio * this.Length2;

            this.MaxLength1 = num - ratio * PulleyJoint.MinPulleyLength;
            this.MaxLength2 = (num - PulleyJoint.MinPulleyLength) / ratio;
        }
Ejemplo n.º 12
0
		/// Initialize the bodies, anchors, lengths, max lengths, and ratio using the world anchors.
		public void Initialize(Body body1, Body body2,
						Vec2 groundAnchor1, Vec2 groundAnchor2,
						Vec2 anchor1, Vec2 anchor2,
						float ratio)
		{
			Body1 = body1;
			Body2 = body2;
			GroundAnchor1 = groundAnchor1;
			GroundAnchor2 = groundAnchor2;
			LocalAnchor1 = body1.GetLocalPoint(anchor1);
			LocalAnchor2 = body2.GetLocalPoint(anchor2);
			Vec2 d1 = anchor1 - groundAnchor1;
			Length1 = d1.Length();
			Vec2 d2 = anchor2 - groundAnchor2;
			Length2 = d2.Length();
			Ratio = ratio;
			Box2DXDebug.Assert(ratio > Settings.FLT_EPSILON);
			float C = Length1 + ratio * Length2;
			MaxLength1 = C - ratio * PulleyJoint.MinPulleyLength;
			MaxLength2 = (C - PulleyJoint.MinPulleyLength) / ratio;
		}
Ejemplo n.º 13
0
        /// Initialize the bodies, anchors, lengths, max lengths, and ratio using the world anchors.
        public void Initialize(Body body1, Body body2,
                               Vec2 groundAnchor1, Vec2 groundAnchor2,
                               Vec2 anchor1, Vec2 anchor2,
                               float ratio)
        {
            Body1         = body1;
            Body2         = body2;
            GroundAnchor1 = groundAnchor1;
            GroundAnchor2 = groundAnchor2;
            LocalAnchor1  = body1.GetLocalPoint(anchor1);
            LocalAnchor2  = body2.GetLocalPoint(anchor2);
            Vec2 d1 = anchor1 - groundAnchor1;

            Length1 = d1.Length();
            Vec2 d2 = anchor2 - groundAnchor2;

            Length2 = d2.Length();
            Ratio   = ratio;
            Box2DXDebug.Assert(ratio > Settings.FLT_EPSILON);
            float C = Length1 + ratio * Length2;

            MaxLength1 = C - ratio * PulleyJoint.MinPulleyLength;
            MaxLength2 = (C - PulleyJoint.MinPulleyLength) / ratio;
        }
Ejemplo n.º 14
0
 /// <summary>
 /// Initialize the bodies, anchors, axis, and reference angle using the world
 /// anchor and world axis.
 /// </summary>
 public void Initialize(Body body1, Body body2, Vector2 anchor, Vector2 axis)
 {
     Body1 = body1;
     Body2 = body2;
     LocalAnchor1 = body1.GetLocalPoint(anchor);
     LocalAnchor2 = body2.GetLocalPoint(anchor);
     LocalAxis1 = body1.GetLocalVector(axis);
     ReferenceAngle = body2.GetAngle() - body1.GetAngle();
 }