Package com.jme3.bullet
Class NativePhysicsObject
java.lang.Object
com.jme3.bullet.NativePhysicsObject
- All Implemented Interfaces:
Comparable<NativePhysicsObject>
- Direct Known Subclasses:
BoundingValueHierarchy
,CharacterController
,CollisionConfiguration
,CollisionShape
,CollisionSpace
,CompoundMesh
,IndexedMesh
,MultiBody
,MultiBodyLink
,PhysicsCollisionEvent
,PhysicsCollisionObject
,PhysicsJoint
,RigidBodyMotionState
,RotationalLimitMotor
,RotationMotor
,SoftBodyMaterial
,SoftBodyWorldInfo
,SolverInfo
,TranslationalLimitMotor
,TranslationMotor
,VehicleController
,VehicleTuning
,Vhacd4Parameters
,VHACDParameters
An abstract class to represent a native (Bullet) physics object.
-
Field Summary
-
Constructor Summary
ModifierConstructorDescriptionprotected
Instantiate with no tracker and no assigned native object. -
Method Summary
Modifier and TypeMethodDescriptionint
compareTo
(NativePhysicsObject other) Compare (by ID) with another native object.static final int
Count how many native objects are being tracked.static final void
Dump all native-object trackers toSystem.out
.boolean
Test for ID equality with another object.static final void
Free any assigned native objects that are known to be unused.final boolean
Test whether a native object is assigned to this instance.int
hashCode()
Return the hash code for this instance.long
nativeId()
Return the ID of the assigned native object, assuming that one is assigned.protected final void
reassignNativeId
(long nativeId) Assign a tracked native object to this instance, unassigning (but not freeing) any previously assigned one.protected void
setNativeId
(long nativeId) Assign a tracked native object to this instance, assuming that no native object is assigned.protected final void
setNativeIdNotTracked
(long nativeId) Assign an untracked native object to this instance, assuming that no native object is assigned.toString()
Represent this instance as a String.protected final void
Unassign (but don't free) the assigned native object, assuming that one is assigned.
-
Field Details
-
loggerN
message logger for this class
-
-
Constructor Details
-
NativePhysicsObject
protected NativePhysicsObject()Instantiate with no tracker and no assigned native object.This no-arg constructor was made explicit to avoid javadoc warnings from JDK 18+.
-
-
Method Details
-
countTrackers
public static final int countTrackers()Count how many native objects are being tracked. This method is intended for debugging.- Returns:
- the count (≥0)
-
dumpTrackers
public static final void dumpTrackers()Dump all native-object trackers toSystem.out
. This method is intended for debugging. -
freeUnusedObjects
public static final void freeUnusedObjects()Free any assigned native objects that are known to be unused. -
hasAssignedNativeObject
public final boolean hasAssignedNativeObject()Test whether a native object is assigned to this instance.- Returns:
- true if one is assigned, otherwise false
-
nativeId
public long nativeId()Return the ID of the assigned native object, assuming that one is assigned.- Returns:
- the native identifier (not zero)
-
reassignNativeId
protected final void reassignNativeId(long nativeId) Assign a tracked native object to this instance, unassigning (but not freeing) any previously assigned one.- Parameters:
nativeId
- the identifier of the native object to assign (not zero)
-
setNativeId
protected void setNativeId(long nativeId) Assign a tracked native object to this instance, assuming that no native object is assigned.- Parameters:
nativeId
- the identifier of the native object to assign (not zero)
-
setNativeIdNotTracked
protected final void setNativeIdNotTracked(long nativeId) Assign an untracked native object to this instance, assuming that no native object is assigned.- Parameters:
nativeId
- the identifier of the native object to assign (not zero)
-
unassignNativeObject
protected final void unassignNativeObject()Unassign (but don't free) the assigned native object, assuming that one is assigned. -
compareTo
Compare (by ID) with another native object.- Specified by:
compareTo
in interfaceComparable<NativePhysicsObject>
- Parameters:
other
- (not null, unaffected)- Returns:
- 0 if the objects have the same native ID; negative if this comes before other; positive if this comes after other
-
equals
Test for ID equality with another object. -
hashCode
public int hashCode()Return the hash code for this instance.Note: operations that alter the native ID are likely to affect the hash code as well!
-
toString
Represent this instance as a String.
-