Search in sources :

Example 1 with SliderConstraint

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

the class SliderJoint method createJoint.

protected void createJoint() {
    Transform transA = new Transform(Converter.convert(rotA));
    Converter.convert(pivotA, transA.origin);
    Converter.convert(rotA, transA.basis);
    Transform transB = new Transform(Converter.convert(rotB));
    Converter.convert(pivotB, transB.origin);
    Converter.convert(rotB, transB.basis);
    constraint = new SliderConstraint(nodeA.getObjectId(), nodeB.getObjectId(), transA, transB, useLinearReferenceFrameA);
}
Also used : SliderConstraint(com.bulletphysics.dynamics.constraintsolver.SliderConstraint) Transform(com.bulletphysics.linearmath.Transform)

Example 2 with SliderConstraint

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

the class SliderJoint method read.

@Override
public void read(JmeImporter im) throws IOException {
    super.read(im);
    InputCapsule capsule = im.getCapsule(this);
    float dampingDirAng = capsule.readFloat("dampingDirAng", 0f);
    float dampingDirLin = capsule.readFloat("dampingDirLin", 0f);
    float dampingLimAng = capsule.readFloat("dampingLimAng", 0f);
    float dampingLimLin = capsule.readFloat("dampingLimLin", 0f);
    float dampingOrthoAng = capsule.readFloat("dampingOrthoAng", 0f);
    float dampingOrthoLin = capsule.readFloat("dampingOrthoLin", 0f);
    float lowerAngLimit = capsule.readFloat("lowerAngLimit", 0f);
    float lowerLinLimit = capsule.readFloat("lowerLinLimit", 0f);
    float maxAngMotorForce = capsule.readFloat("maxAngMotorForce", 0f);
    float maxLinMotorForce = capsule.readFloat("maxLinMotorForce", 0f);
    boolean poweredAngMotor = capsule.readBoolean("poweredAngMotor", false);
    boolean poweredLinMotor = capsule.readBoolean("poweredLinMotor", false);
    float restitutionDirAng = capsule.readFloat("restitutionDirAng", 0f);
    float restitutionDirLin = capsule.readFloat("restitutionDirLin", 0f);
    float restitutionLimAng = capsule.readFloat("restitutionLimAng", 0f);
    float restitutionLimLin = capsule.readFloat("restitutionLimLin", 0f);
    float restitutionOrthoAng = capsule.readFloat("restitutionOrthoAng", 0f);
    float restitutionOrthoLin = capsule.readFloat("restitutionOrthoLin", 0f);
    float softnessDirAng = capsule.readFloat("softnessDirAng", 0f);
    float softnessDirLin = capsule.readFloat("softnessDirLin", 0f);
    float softnessLimAng = capsule.readFloat("softnessLimAng", 0f);
    float softnessLimLin = capsule.readFloat("softnessLimLin", 0f);
    float softnessOrthoAng = capsule.readFloat("softnessOrthoAng", 0f);
    float softnessOrthoLin = capsule.readFloat("softnessOrthoLin", 0f);
    float targetAngMotorVelicoty = capsule.readFloat("targetAngMotorVelicoty", 0f);
    float targetLinMotorVelicoty = capsule.readFloat("targetLinMotorVelicoty", 0f);
    float upperAngLimit = capsule.readFloat("upperAngLimit", 0f);
    float upperLinLimit = capsule.readFloat("upperLinLimit", 0f);
    useLinearReferenceFrameA = capsule.readBoolean("useLinearReferenceFrameA", false);
    createJoint();
    ((SliderConstraint) constraint).setDampingDirAng(dampingDirAng);
    ((SliderConstraint) constraint).setDampingDirLin(dampingDirLin);
    ((SliderConstraint) constraint).setDampingLimAng(dampingLimAng);
    ((SliderConstraint) constraint).setDampingLimLin(dampingLimLin);
    ((SliderConstraint) constraint).setDampingOrthoAng(dampingOrthoAng);
    ((SliderConstraint) constraint).setDampingOrthoLin(dampingOrthoLin);
    ((SliderConstraint) constraint).setLowerAngLimit(lowerAngLimit);
    ((SliderConstraint) constraint).setLowerLinLimit(lowerLinLimit);
    ((SliderConstraint) constraint).setMaxAngMotorForce(maxAngMotorForce);
    ((SliderConstraint) constraint).setMaxLinMotorForce(maxLinMotorForce);
    ((SliderConstraint) constraint).setPoweredAngMotor(poweredAngMotor);
    ((SliderConstraint) constraint).setPoweredLinMotor(poweredLinMotor);
    ((SliderConstraint) constraint).setRestitutionDirAng(restitutionDirAng);
    ((SliderConstraint) constraint).setRestitutionDirLin(restitutionDirLin);
    ((SliderConstraint) constraint).setRestitutionLimAng(restitutionLimAng);
    ((SliderConstraint) constraint).setRestitutionLimLin(restitutionLimLin);
    ((SliderConstraint) constraint).setRestitutionOrthoAng(restitutionOrthoAng);
    ((SliderConstraint) constraint).setRestitutionOrthoLin(restitutionOrthoLin);
    ((SliderConstraint) constraint).setSoftnessDirAng(softnessDirAng);
    ((SliderConstraint) constraint).setSoftnessDirLin(softnessDirLin);
    ((SliderConstraint) constraint).setSoftnessLimAng(softnessLimAng);
    ((SliderConstraint) constraint).setSoftnessLimLin(softnessLimLin);
    ((SliderConstraint) constraint).setSoftnessOrthoAng(softnessOrthoAng);
    ((SliderConstraint) constraint).setSoftnessOrthoLin(softnessOrthoLin);
    ((SliderConstraint) constraint).setTargetAngMotorVelocity(targetAngMotorVelicoty);
    ((SliderConstraint) constraint).setTargetLinMotorVelocity(targetLinMotorVelicoty);
    ((SliderConstraint) constraint).setUpperAngLimit(upperAngLimit);
    ((SliderConstraint) constraint).setUpperLinLimit(upperLinLimit);
}
Also used : InputCapsule(com.jme3.export.InputCapsule) SliderConstraint(com.bulletphysics.dynamics.constraintsolver.SliderConstraint)

Aggregations

SliderConstraint (com.bulletphysics.dynamics.constraintsolver.SliderConstraint)2 Transform (com.bulletphysics.linearmath.Transform)1 InputCapsule (com.jme3.export.InputCapsule)1