Package com.jme3.bullet.joints
Class PhysicsJoint
java.lang.Object
com.jme3.bullet.NativePhysicsObject
com.jme3.bullet.joints.PhysicsJoint
- All Implemented Interfaces:
Comparable<NativePhysicsObject>
- Direct Known Subclasses:
Anchor
,Constraint
,SoftPhysicsJoint
The abstract base class for physics joints based on Bullet's
btTypedConstraint, btSoftBody::Anchor, or btSoftBody::Joint.
-
Field Summary
Fields inherited from class com.jme3.bullet.NativePhysicsObject
loggerN
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
Count how many ends this joint has.void
destroy()
Remove this joint from the joint lists of both ends.findEnd
(PhysicsBody body) Test whether the specified body is an end of this joint.findOtherBody
(PhysicsBody body) Access the remaining body of this joint.Access the body at the specified end of this joint.getBodyA()
Access the body at the joint's "A" end.getBodyB()
Access the body at the joint's "B" end.Access the PhysicsSpace where this joint is added.abstract boolean
Test whether this joint is enabled.protected final void
setBodyA
(PhysicsBody body) Specify the body at the joint's "A" end.protected final void
setBodyB
(PhysicsBody body) Specify the body at the joint's "B" end.protected void
setNativeId
(long jointId) Initialize the native ID.void
setPhysicsSpace
(PhysicsSpace physicsSpace) Alter which PhysicsSpace this joint is added to.toString()
Represent this joint as a String.Methods inherited from class com.jme3.bullet.NativePhysicsObject
compareTo, countTrackers, dumpTrackers, equals, freeUnusedObjects, hasAssignedNativeObject, hashCode, nativeId, reassignNativeId, setNativeIdNotTracked, unassignNativeObject
-
Field Details
-
logger
message logger for this class
-
-
Constructor Details
-
PhysicsJoint
protected PhysicsJoint()Instantiate a PhysicsJoint.This no-arg constructor was made explicit to avoid javadoc warnings from JDK 18+.
-
-
Method Details
-
countEnds
public int countEnds()Count how many ends this joint has.- Returns:
- 1 if single-ended, 2 if double-ended
-
destroy
public void destroy()Remove this joint from the joint lists of both ends. -
findEnd
Test whether the specified body is an end of this joint.- Parameters:
body
- the body to find (not null, unaffected)- Returns:
- the enum value if found, otherwise null
-
findOtherBody
Access the remaining body of this joint.- Parameters:
body
- (not null, unaffected)- Returns:
- the body at the other end (null if not found or the joint is single-ended)
-
getBody
Access the body at the specified end of this joint.- Parameters:
end
- which end of the joint to access (not null)- Returns:
- the pre-existing body, or null if none
-
getBodyA
Access the body at the joint's "A" end.- Returns:
- the pre-existing body, or null if none
-
getBodyB
Access the body at the joint's "B" end.- Returns:
- the pre-existing body, or null if none
-
getPhysicsSpace
Access the PhysicsSpace where this joint is added.- Returns:
- the pre-existing instance, or null if none
-
isEnabled
public abstract boolean isEnabled()Test whether this joint is enabled.- Returns:
- true if enabled, otherwise false
-
setPhysicsSpace
Alter which PhysicsSpace this joint is added to. Do not invoke directly! The field is updated automatically when added/removed.- Parameters:
physicsSpace
- (may be null)
-
setBodyA
Specify the body at the joint's "A" end.- Parameters:
body
- the desired body (not null, alias created)
-
setBodyB
Specify the body at the joint's "B" end.- Parameters:
body
- the desired body (not null, alias created)
-
setNativeId
protected void setNativeId(long jointId) Initialize the native ID.- Overrides:
setNativeId
in classNativePhysicsObject
- Parameters:
jointId
- the native identifier of the btTypedConstraint, btSoftBody::Anchor, or btSoftBody::Joint (not zero)
-
toString
Represent this joint as a String.- Overrides:
toString
in classNativePhysicsObject
- Returns:
- a descriptive string of text (not null, not empty)
-