Package com.jme3.bullet.joints
Class SoftPhysicsJoint
java.lang.Object
com.jme3.bullet.NativePhysicsObject
com.jme3.bullet.joints.PhysicsJoint
com.jme3.bullet.joints.SoftPhysicsJoint
- All Implemented Interfaces:
com.jme3.export.Savable,com.jme3.util.clone.JmeCloneable,Cloneable,Comparable<NativePhysicsObject>
- Direct Known Subclasses:
SoftAngularJoint,SoftLinearJoint
The abstract base class for joining a PhysicsSoftBody to another body, based
on Bullet's btSoftBody::Joint. A SoftPhysicsJoint can be soft-soft or
soft-rigid:
- a soft-soft joint joins particular clusters of 2 distinct soft bodies
- a soft-rigid joint joins a particular cluster of a soft body to a rigid body
To join a particular *node* of a soft body to a rigid body, use an Anchor instead.
-
Field Summary
FieldsFields inherited from class com.jme3.bullet.joints.PhysicsJoint
loggerFields inherited from class com.jme3.bullet.NativePhysicsObject
loggerN -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedNo-argument constructor needed by SavableClassUtil.protectedSoftPhysicsJoint(PhysicsSoftBody softBodyA, int clusterIndexA, PhysicsRigidBody rigidBodyB) Instantiate a SoftPhysicsJoint to join a soft-body cluster and a rigid body.protectedSoftPhysicsJoint(PhysicsSoftBody softBodyA, int clusterIndexA, PhysicsSoftBody softBodyB, int clusterIndexB) Instantiate a SoftPhysicsJoint to join 2 soft bodies. -
Method Summary
Modifier and TypeMethodDescriptionbooleanCompare Bullet parameters against their local copies.intRead the index of the cluster for the A end.intRead the index of the cluster for the B end.protected static voidfinalizeNative(long jointId) Finalize thebtTypedConstraint.floatgetCFM()Read the constraint force mixing coefficient (aka CFM).floatgetERP()Read the error-reduction parameter (aka ERP).Access the soft body at the A end.Access the soft body at the B end.floatgetSplit()Return the split.booleanTest whether this joint is enabled.booleanTest whether this joint is a soft-rigid joint.booleanTest whether this joint is a soft-soft joint.voidread(com.jme3.export.JmeImporter importer) De-serialize this joint from the specified importer, for example when loading from a J3O file.voidsetCFM(float cfm) Set the constraint force mixing coefficient (aka CFM).voidsetERP(float erp) Set the error-reduction parameter (aka ERP).voidsetSplit(float split) Alter the split.voidwrite(com.jme3.export.JmeExporter exporter) Serialize this joint to the specified exporter, for example when saving to a J3O file.Methods inherited from class com.jme3.bullet.joints.PhysicsJoint
cloneFields, countEnds, destroy, findEnd, findOtherBody, getBody, getBodyA, getBodyB, getPhysicsSpace, jmeClone, setBodyA, setBodyB, setNativeId, setPhysicsSpace, toStringMethods inherited from class com.jme3.bullet.NativePhysicsObject
compareTo, countTrackers, dumpTrackers, equals, freeUnusedObjects, hasAssignedNativeObject, hashCode, nativeId, reassignNativeId, setNativeIdNotTracked, unassignNativeObject
-
Field Details
-
logger2
message logger for this class
-
-
Constructor Details
-
SoftPhysicsJoint
protected SoftPhysicsJoint()No-argument constructor needed by SavableClassUtil. -
SoftPhysicsJoint
protected SoftPhysicsJoint(PhysicsSoftBody softBodyA, int clusterIndexA, PhysicsRigidBody rigidBodyB) Instantiate a SoftPhysicsJoint to join a soft-body cluster and a rigid body.To be fully effective, the joint must be added to the PhysicsSoftSpace of both bodies.
- Parameters:
softBodyA- the soft body for the A end (not null, alias created)clusterIndexA- the index of the cluster for the A end (≥0)rigidBodyB- the rigid body for the B end (not null, alias created)
-
SoftPhysicsJoint
protected SoftPhysicsJoint(PhysicsSoftBody softBodyA, int clusterIndexA, PhysicsSoftBody softBodyB, int clusterIndexB) Instantiate a SoftPhysicsJoint to join 2 soft bodies.To be effective, the joint must be added to the PhysicsSoftSpace of both bodies. Also, the bodies must be distinct.
- Parameters:
softBodyA- the body for the A end (not null, alias created)clusterIndexA- the index of the cluster for the A end (≥0)softBodyB- the body for the B end (not null, alias created)clusterIndexB- the index of the cluster for the B end (≥0)
-
-
Method Details
-
checkParameters
public boolean checkParameters()Compare Bullet parameters against their local copies.- Returns:
- true if the local copies are accurate, otherwise false
-
clusterIndexA
public int clusterIndexA()Read the index of the cluster for the A end.- Returns:
- the index (≥0)
-
clusterIndexB
public int clusterIndexB()Read the index of the cluster for the B end.- Returns:
- the index (≥0) or -1 for a soft-rigid joint
-
getCFM
public float getCFM()Read the constraint force mixing coefficient (aka CFM).From the Bullet documentation:
- If CFM=0 then the constraint will be hard.
- If CFM is set to a positive value, it will be possible to violate the constraint by "pushing on it" (for example, for contact constraints by forcing the two contacting objects together). In other words the constraint will be soft, and the softness will increase as CFM increases.
- Returns:
- the coefficient value (≥0)
-
getERP
public float getERP()Read the error-reduction parameter (aka ERP).From the Bullet documentation:
The ERP specifies what proportion of the joint error will be fixed during the next simulation step.
- If ERP=0 then no correcting force is applied and the bodies will eventually drift apart as the simulation proceeds.
- If ERP=1 then the simulation will attempt to fix all joint error during the next simulation step. However, setting ERP=1 is not recommended, as the joint error will not be completely fixed due to various internal approximations.
- Returns:
- the parameter value (≥0, ≤1, default=1)
-
getSoftBodyA
Access the soft body at the A end.- Returns:
- the pre-existing soft body (not null)
-
getSoftBodyB
Access the soft body at the B end.- Returns:
- the pre-existing soft body, or null for a soft-rigid joint
-
getSplit
public float getSplit()Return the split.- Returns:
- the split value
-
isSoftRigid
public boolean isSoftRigid()Test whether this joint is a soft-rigid joint.- Returns:
- true if soft-rigid, otherwise false
-
isSoftSoft
public boolean isSoftSoft()Test whether this joint is a soft-soft joint.- Returns:
- true if soft-soft, otherwise false
-
setCFM
public void setCFM(float cfm) Set the constraint force mixing coefficient (aka CFM).From the Bullet documentation:
- If CFM=0 then the constraint will be hard.
- If CFM is set to a positive value, it will be possible to violate the constraint by "pushing on it" (for example, for contact constraints by forcing the two contacting objects together). In other words the constraint will be soft, and the softness will increase as CFM increases.
Setting CFM to a negative value can cause instability.
- Parameters:
cfm- the desired coefficient value (≥0, default=1)
-
setERP
public void setERP(float erp) Set the error-reduction parameter (aka ERP).From the Bullet documentation:
The ERP specifies what proportion of the joint error will be fixed during the next simulation step.
- If ERP=0 then no correcting force is applied and the bodies will eventually drift apart as the simulation proceeds.
- If ERP=1 then the simulation will attempt to fix all joint error during the next simulation step. However, setting ERP=1 is not recommended, as the joint error will not be completely fixed due to various internal approximations.
- Parameters:
erp- the desired parameter value (≥0, ≤1, default=1)
-
setSplit
public void setSplit(float split) Alter the split.- Parameters:
split- the desired split value (default=1)
-
finalizeNative
protected static void finalizeNative(long jointId) Finalize thebtTypedConstraint.- Parameters:
jointId- identifier of thebtSoftBody::Joint(not zero)
-
isEnabled
public boolean isEnabled()Test whether this joint is enabled.- Specified by:
isEnabledin classPhysicsJoint- Returns:
- true
-
read
De-serialize this joint from the specified importer, for example when loading from a J3O file.- Specified by:
readin interfacecom.jme3.export.Savable- Overrides:
readin classPhysicsJoint- Parameters:
importer- (not null)- Throws:
IOException- from the importer
-
write
Serialize this joint to the specified exporter, for example when saving to a J3O file.- Specified by:
writein interfacecom.jme3.export.Savable- Overrides:
writein classPhysicsJoint- Parameters:
exporter- (not null)- Throws:
IOException- from the exporter
-