Search in sources :

Example 1 with HingeConstraint

use of com.bulletphysics.dynamics.constraintsolver.HingeConstraint in project jmonkeyengine by jMonkeyEngine.

the class HingeJoint method read.

public void read(JmeImporter im) throws IOException {
    super.read(im);
    InputCapsule capsule = im.getCapsule(this);
    this.axisA = (Vector3f) capsule.readSavable("axisA", new Vector3f());
    this.axisB = (Vector3f) capsule.readSavable("axisB", new Vector3f());
    this.angularOnly = capsule.readBoolean("angularOnly", false);
    float lowerLimit = capsule.readFloat("lowerLimit", 1e30f);
    float upperLimit = capsule.readFloat("upperLimit", -1e30f);
    this.biasFactor = capsule.readFloat("biasFactor", 0.3f);
    this.relaxationFactor = capsule.readFloat("relaxationFactor", 1f);
    this.limitSoftness = capsule.readFloat("limitSoftness", 0.9f);
    boolean enableAngularMotor = capsule.readBoolean("enableAngularMotor", false);
    float targetVelocity = capsule.readFloat("targetVelocity", 0.0f);
    float maxMotorImpulse = capsule.readFloat("maxMotorImpulse", 0.0f);
    createJoint();
    enableMotor(enableAngularMotor, targetVelocity, maxMotorImpulse);
    ((HingeConstraint) constraint).setLimit(lowerLimit, upperLimit, limitSoftness, biasFactor, relaxationFactor);
}
Also used : InputCapsule(com.jme3.export.InputCapsule) Vector3f(com.jme3.math.Vector3f) HingeConstraint(com.bulletphysics.dynamics.constraintsolver.HingeConstraint)

Aggregations

HingeConstraint (com.bulletphysics.dynamics.constraintsolver.HingeConstraint)1 InputCapsule (com.jme3.export.InputCapsule)1 Vector3f (com.jme3.math.Vector3f)1