private native void enableMotor(long objectId, boolean enable, float targetVelocity, float maxMotorImpulse);
/** * Creates a new HingeJoint * @param pivotA local translation of the joint connection point in node A * @param pivotB local translation of the joint connection point in node B */ public HingeJoint(PhysicsRigidBody nodeA, PhysicsRigidBody nodeB, Vector3f pivotA, Vector3f pivotB, Vector3f axisA, Vector3f axisB) { super(nodeA, nodeB, pivotA, pivotB); this.axisA = axisA; this.axisB = axisB; createJoint(); }
/** * Test whether this joint's motor is enabled. * * @return true if enabled, otherwise false */ public boolean getEnableMotor() { return getEnableAngularMotor(objectId); }
private native long createJoint(long objectIdA, long objectIdB, Vector3f pivotA, Vector3f axisA, Vector3f pivotB, Vector3f axisB); }
/** * Serialize this joint, for example when saving to a J3O file. * * @param ex exporter (not null) * @throws IOException from exporter */ public void write(JmeExporter ex) throws IOException { super.write(ex); OutputCapsule capsule = ex.getCapsule(this); capsule.write(axisA, "axisA", new Vector3f()); capsule.write(axisB, "axisB", new Vector3f()); capsule.write(angularOnly, "angularOnly", false); capsule.write(getLowerLimit(), "lowerLimit", 1e30f); capsule.write(getUpperLimit(), "upperLimit", -1e30f); capsule.write(biasFactor, "biasFactor", 0.3f); capsule.write(relaxationFactor, "relaxationFactor", 1f); capsule.write(limitSoftness, "limitSoftness", 0.9f); capsule.write(getEnableMotor(), "enableAngularMotor", false); capsule.write(getMotorTargetVelocity(), "targetVelocity", 0.0f); capsule.write(getMaxMotorImpulse(), "maxMotorImpulse", 0.0f); }
/** * De-serialize this joint, for example when loading from a J3O file. * * @param im importer (not null) * @throws IOException from importer */ 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); setLimit(lowerLimit, upperLimit, limitSoftness, biasFactor, relaxationFactor); }
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); }
private native float getLowerLimit(long objectId);
private native float getMotorTargetVelocity(long objectId);
private native void setAngularOnly(long objectId, boolean angularOnly);
private native float getMaxMotorImpulse(long objectId);
private native float getUpperLimit(long objectId);
private native float getHingeAngle(long objectId);
public void write(JmeExporter ex) throws IOException { super.write(ex); OutputCapsule capsule = ex.getCapsule(this); capsule.write(axisA, "axisA", new Vector3f()); capsule.write(axisB, "axisB", new Vector3f()); capsule.write(angularOnly, "angularOnly", false); capsule.write(getLowerLimit(), "lowerLimit", 1e30f); capsule.write(getUpperLimit(), "upperLimit", -1e30f); capsule.write(biasFactor, "biasFactor", 0.3f); capsule.write(relaxationFactor, "relaxationFactor", 1f); capsule.write(limitSoftness, "limitSoftness", 0.9f); capsule.write(getEnableMotor(), "enableAngularMotor", false); capsule.write(getMotorTargetVelocity(), "targetVelocity", 0.0f); capsule.write(getMaxMotorImpulse(), "maxMotorImpulse", 0.0f); }
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); setLimit(lowerLimit, upperLimit, limitSoftness, biasFactor, relaxationFactor); }
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); }
private native float getLowerLimit(long objectId);
private native float getMotorTargetVelocity(long objectId);
private native void setAngularOnly(long objectId, boolean angularOnly);
private native float getMaxMotorImpulse(long objectId);