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
Fields inherited from class com.jme3.bullet.joints.PhysicsJoint
logger
Fields inherited from class com.jme3.bullet.NativePhysicsObject
loggerN
-
Constructor Summary
ModifierConstructorDescriptionprotected
No-argument constructor needed by SavableClassUtil.protected
SoftPhysicsJoint
(PhysicsSoftBody softBodyA, int clusterIndexA, PhysicsRigidBody rigidBodyB) Instantiate a SoftPhysicsJoint to join a soft-body cluster and a rigid body.protected
SoftPhysicsJoint
(PhysicsSoftBody softBodyA, int clusterIndexA, PhysicsSoftBody softBodyB, int clusterIndexB) Instantiate a SoftPhysicsJoint to join 2 soft bodies. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Compare Bullet parameters against their local copies.int
Read the index of the cluster for the A end.int
Read the index of the cluster for the B end.protected static void
finalizeNative
(long jointId) Finalize thebtTypedConstraint
.float
getCFM()
Read the constraint force mixing coefficient (aka CFM).float
getERP()
Read the error-reduction parameter (aka ERP).Access the soft body at the A end.Access the soft body at the B end.float
getSplit()
Return the split.boolean
Test whether this joint is enabled.boolean
Test whether this joint is a soft-rigid joint.boolean
Test whether this joint is a soft-soft joint.void
read
(com.jme3.export.JmeImporter importer) De-serialize this joint from the specified importer, for example when loading from a J3O file.void
setCFM
(float cfm) Set the constraint force mixing coefficient (aka CFM).void
setERP
(float erp) Set the error-reduction parameter (aka ERP).void
setSplit
(float split) Alter the split.void
write
(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, toString
Methods 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:
isEnabled
in classPhysicsJoint
- Returns:
- true
-
read
De-serialize this joint from the specified importer, for example when loading from a J3O file.- Specified by:
read
in interfacecom.jme3.export.Savable
- Overrides:
read
in 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:
write
in interfacecom.jme3.export.Savable
- Overrides:
write
in classPhysicsJoint
- Parameters:
exporter
- (not null)- Throws:
IOException
- from the exporter
-