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

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

Introduction

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

Prototype

public void initialize(Body bodyA, Body bodyB, Vector2 anchor) 

Source Link

Document

Initialize the bodies, anchors, axis, and reference angle using the world anchor and world axis.

Usage

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

License:Open Source License

/**
 * As friction joint def./*from   www  . j  a  va 2 s  .  c  o  m*/
 *
 * @param bodyA the body a
 * @param bodyB the body b
 * @param _j the _j
 * @return the friction joint def
 */
public static FrictionJointDef asFrictionJointDef(Body bodyA, Body bodyB, CGJoint _j) {
    FrictionJointDef jdef = new FrictionJointDef();
    jdef.collideConnected = _j.getFrictionJointDef().getCollideConnected();
    jdef.maxForce = _j.getFrictionJointDef().getMaxForce();
    jdef.maxTorque = _j.getFrictionJointDef().getMaxTorque();
    jdef.initialize(bodyA, bodyB, bodyA.getWorldCenter());

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

    return jdef;
}