Example usage for com.badlogic.gdx.physics.box2d.joints PulleyJointDef initialize

List of usage examples for com.badlogic.gdx.physics.box2d.joints PulleyJointDef initialize

Introduction

In this page you can find the example usage for com.badlogic.gdx.physics.box2d.joints PulleyJointDef initialize.

Prototype

public void initialize(Body bodyA, Body bodyB, Vector2 groundAnchorA, Vector2 groundAnchorB, Vector2 anchorA,
        Vector2 anchorB, float ratio) 

Source Link

Document

Initialize the bodies, anchors, lengths, max lengths, and ratio using the world anchors.

Usage

From source file:com.laex.cg2d.render.util.ProtoBufTypeConversionUtil.java

License:Open Source License

/**
 * As pulley joint def.// w  w  w .ja v a 2s  .c o  m
 *
 * @param bodyA the body a
 * @param bodyB the body b
 * @param _j the _j
 * @return the pulley joint def
 */
public static PulleyJointDef asPulleyJointDef(Body bodyA, Body bodyB, CGJoint _j) {
    PulleyJointDef jdef = new PulleyJointDef();
    jdef.collideConnected = _j.getPulleyJointDef().getCollideConnected();
    jdef.ratio = _j.getPulleyJointDef().getRatio();
    jdef.initialize(bodyA, bodyB,
            ProtoBufTypeConversionUtil.asVector2(_j.getPulleyJointDef().getGroundAnchorA()),
            ProtoBufTypeConversionUtil.asVector2(_j.getPulleyJointDef().getGroundAnchorB()),
            bodyA.getWorldCenter(), bodyB.getWorldCenter(), _j.getPulleyJointDef().getRatio());

    if (_j.getUseLocalAnchors()) {
        jdef.localAnchorA.set(Vector2Adapter.asVector2(_j.getLocalAnchorA()));
        jdef.localAnchorB.set(Vector2Adapter.asVector2(_j.getLocalAnchorB()));
    }

    return jdef;
}