Package com.jme3.bullet.objects
Class PhysicsBody
java.lang.Object
com.jme3.bullet.NativePhysicsObject
com.jme3.bullet.collision.PhysicsCollisionObject
com.jme3.bullet.objects.PhysicsBody
- All Implemented Interfaces:
com.jme3.export.Savable,com.jme3.util.clone.JmeCloneable,Cloneable,Comparable<NativePhysicsObject>
- Direct Known Subclasses:
PhysicsRigidBody,PhysicsSoftBody
The abstract base class for rigid bodies and soft bodies.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final floatmagic mass value used to specify a static rigid body or soft-body nodeFields inherited from class com.jme3.bullet.collision.PhysicsCollisionObject
COLLISION_GROUP_01, COLLISION_GROUP_02, COLLISION_GROUP_03, COLLISION_GROUP_04, COLLISION_GROUP_05, COLLISION_GROUP_06, COLLISION_GROUP_07, COLLISION_GROUP_08, COLLISION_GROUP_09, COLLISION_GROUP_10, COLLISION_GROUP_11, COLLISION_GROUP_12, COLLISION_GROUP_13, COLLISION_GROUP_14, COLLISION_GROUP_15, COLLISION_GROUP_16, COLLISION_GROUP_NONE, loggerFields inherited from class com.jme3.bullet.NativePhysicsObject
loggerN -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddJoint(PhysicsJoint joint) Do not invoke directly! Joints are added automatically when created.voidcloneFields(com.jme3.util.clone.Cloner cloner, Object original) Callback fromClonerto convert this shallow-cloned body into a deep-cloned one, using the specified Cloner and original to resolve copied fields.protected voidcloneJoints(com.jme3.util.clone.Cloner cloner, PhysicsBody old) Clone this body's joints.intCount how many joints connect to this body.static floatReturn the global deactivation deadline.abstract com.jme3.math.Vector3fgetGravity(com.jme3.math.Vector3f storeResult) Copy this body's gravitational acceleration.abstract floatgetMass()Determine the total mass of this body.static booleanTest the global deactivation enable flag.Enumerate the joints connected to this body.protected voidreadJoints(com.jme3.export.InputCapsule capsule) De-serialize joints from the specified InputCapsule, for example when loading from a J3O file.voidremoveJoint(PhysicsJoint joint) Do not invoke directly! Joints are removed automatically when destroyed.static voidsetDeactivationDeadline(float newDeadline) Alter the global deactivation deadline.static voidsetDeactivationEnabled(boolean newSetting) Alter the global deactivation enable flag.abstract voidsetGravity(com.jme3.math.Vector3f acceleration) Alter this body's gravitational acceleration.abstract voidsetMass(float mass) Alter this body's total mass.abstract voidsetPhysicsLocation(com.jme3.math.Vector3f location) Directly relocate this body's center.protected voidwriteJoints(com.jme3.export.OutputCapsule capsule) Serialize joints to the specified OutputCapsule, for example when saving to a J3O file.Methods inherited from class com.jme3.bullet.collision.PhysicsCollisionObject
activate, addCollideWithGroup, addToIgnoreList, attachCollisionShape, boundingBox, clearIgnoreList, cloneIgnoreList, collisionFlags, copyPcoProperties, countIgnored, debugMeshInitListener, debugMeshNormals, debugMeshResolution, debugNumSides, finalizeNative, findInstance, getActivationState, getAnisotropicFriction, getApplicationData, getCcdMotionThreshold, getCcdSquareMotionThreshold, getCcdSweptSphereRadius, getCollideWithGroups, getCollisionGroup, getCollisionShape, getCollisionSpace, getContactDamping, getContactProcessingThreshold, getContactStiffness, getDeactivationTime, getDebugMaterial, getFriction, getInternalType, getPhysicsLocation, getPhysicsLocation, getPhysicsLocationDp, getPhysicsRotation, getPhysicsRotationDp, getPhysicsRotationMatrix, getPhysicsRotationMatrixDp, getRestitution, getRollingFriction, getScale, getSpinningFriction, getTransform, getUserObject, hasAnisotropicFriction, ignores, initUserPointer, isActive, isContactResponse, isInWorld, isStatic, jmeClone, listIgnoredPcos, proxyGroup, proxyMask, read, readPcoProperties, removeCollideWithGroup, removeFromIgnoreList, setActivationState, setAnisotropicFriction, setApplicationData, setCcdMotionThreshold, setCcdSweptSphereRadius, setCollideWithGroups, setCollisionFlags, setCollisionGroup, setCollisionShape, setContactDamping, setContactProcessingThreshold, setContactStiffness, setDeactivationTime, setDebugMaterial, setDebugMeshInitListener, setDebugMeshNormals, setDebugMeshResolution, setDebugNumSides, setFriction, setIgnoreList, setLocationAndBasis, setRestitution, setRollingFriction, setSpinningFriction, setUserIndex, setUserIndex2, setUserIndex3, setUserObject, spaceId, toString, userIndex, userIndex2, userIndex3, writeMethods inherited from class com.jme3.bullet.NativePhysicsObject
compareTo, countTrackers, dumpTrackers, equals, freeUnusedObjects, hasAssignedNativeObject, hashCode, nativeId, reassignNativeId, setNativeId, setNativeIdNotTracked, unassignNativeObject
-
Field Details
-
massForStatic
public static final float massForStaticmagic mass value used to specify a static rigid body or soft-body node- See Also:
-
-
Constructor Details
-
PhysicsBody
protected PhysicsBody()Instantiate a PhysicsBody.This no-arg constructor was made explicit to avoid javadoc warnings from JDK 18+.
-
-
Method Details
-
addJoint
Do not invoke directly! Joints are added automatically when created.- Parameters:
joint- the joint to add (not null, alias created)
-
cloneJoints
Clone this body's joints.- Parameters:
cloner- the Cloner that's cloning this body (not null, modified)old- the instance from which this body was shallow-cloned (not null, unaffected)
-
countJoints
public int countJoints()Count how many joints connect to this body. (The semantics have changed since Minie v2.)- Returns:
- the count (≥0)
-
getDeactivationDeadline
public static float getDeactivationDeadline()Return the global deactivation deadline.- Returns:
- the deadline (in simulated seconds, >0)
-
getGravity
public abstract com.jme3.math.Vector3f getGravity(com.jme3.math.Vector3f storeResult) Copy this body's gravitational acceleration.- Parameters:
storeResult- storage for the result (modified if not null)- Returns:
- an acceleration vector (in physics-space coordinates, either storeResult or a new vector, not null)
-
getMass
public abstract float getMass()Determine the total mass of this body.- Returns:
- the total mass (≥0)
-
isDeactivationEnabled
public static boolean isDeactivationEnabled()Test the global deactivation enable flag.- Returns:
- true if deactivation is enabled, otherwise false
-
listJoints
Enumerate the joints connected to this body. (The semantics have changed since Minie v2.)- Returns:
- a new array of pre-existing joints
-
readJoints
De-serialize joints from the specified InputCapsule, for example when loading from a J3O file.- Parameters:
capsule- (not null, modified)- Throws:
IOException- from the capsule
-
removeJoint
Do not invoke directly! Joints are removed automatically when destroyed.- Parameters:
joint- the joint to remove (not null, unaffected)- See Also:
-
setDeactivationDeadline
public static void setDeactivationDeadline(float newDeadline) Alter the global deactivation deadline.- Parameters:
newDeadline- the desired deadline (in simulated seconds, >0, default=2)
-
setDeactivationEnabled
public static void setDeactivationEnabled(boolean newSetting) Alter the global deactivation enable flag.- Parameters:
newSetting- true to enable deactivation, false to disable it (default=true)
-
setGravity
public abstract void setGravity(com.jme3.math.Vector3f acceleration) Alter this body's gravitational acceleration.Invoke this method after adding the body to a PhysicsSpace. Adding a body to a PhysicsSpace overrides its gravity.
- Parameters:
acceleration- the desired acceleration vector (in physics-space coordinates, not null, unaffected)
-
setMass
public abstract void setMass(float mass) Alter this body's total mass.- Parameters:
mass- the desired total mass (≥0)
-
setPhysicsLocation
public abstract void setPhysicsLocation(com.jme3.math.Vector3f location) Directly relocate this body's center.- Parameters:
location- the desired location (in physics-space coordinates, not null, unaffected)
-
writeJoints
Serialize joints to the specified OutputCapsule, for example when saving to a J3O file.- Parameters:
capsule- (not null, modified)- Throws:
IOException- from the capsule
-
cloneFields
Callback fromClonerto convert this shallow-cloned body into a deep-cloned one, using the specified Cloner and original to resolve copied fields.- Specified by:
cloneFieldsin interfacecom.jme3.util.clone.JmeCloneable- Overrides:
cloneFieldsin classPhysicsCollisionObject- Parameters:
cloner- the Cloner that's cloning this body (not null)original- the instance from which this body was shallow-cloned (not null, unaffected)
-