Box2DX.Dynamics.RevoluteJointDef.Initialize C# (CSharp) Метод

Initialize() публичный Метод

Initialize the bodies, anchors, and reference angle using the world anchor.
public Initialize ( Body body1, Body body2, Vec2 anchor ) : void
body1 Body
body2 Body
anchor Box2DX.Common.Vec2
Результат void
        public void Initialize(Body body1, Body body2, Vec2 anchor)
        {
            Body1 = body1;
            Body2 = body2;
            LocalAnchor1 = body1.GetLocalPoint(anchor);
            LocalAnchor2 = body2.GetLocalPoint(anchor);
            ReferenceAngle = body2.GetAngle() - body1.GetAngle();
        }

Usage Example

 /** Handles anchoring the first and last pieces of the bridge
  * to the world versus to other bridge pieces
  */
 private void CreateEndJoint(World world, bool leftEnd)
 {
     RevoluteJointDef joint = new RevoluteJointDef();
     Vector2 anchor = Position - new Vector2(width/2, 0);
     if (!leftEnd)
         anchor = Position + new Vector2(width / 2, 0);
     joint.Initialize(Body, world.GetGroundBody(), Utils.Convert(anchor));
     world.CreateJoint(joint);
 }
All Usage Examples Of Box2DX.Dynamics.RevoluteJointDef::Initialize