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:
Comparable<NativePhysicsObject>
- Direct Known Subclasses:
PhysicsRigidBody
,PhysicsSoftBody
The abstract base class for rigid bodies and soft bodies.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final float
magic 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, logger
Fields inherited from class com.jme3.bullet.NativePhysicsObject
loggerN
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addJoint
(PhysicsJoint joint) Do not invoke directly! Joints are added automatically when created.int
Count how many joints connect to this body.static float
Return the global deactivation deadline.abstract Vector3f
getGravity
(Vector3f storeResult) Copy this body's gravitational acceleration.abstract float
getMass()
Determine the total mass of this body.static boolean
Test the global deactivation enable flag.Enumerate the joints connected to this body.void
removeJoint
(PhysicsJoint joint) Do not invoke directly! Joints are removed automatically when destroyed.static void
setDeactivationDeadline
(float newDeadline) Alter the global deactivation deadline.static void
setDeactivationEnabled
(boolean newSetting) Alter the global deactivation enable flag.abstract void
setGravity
(Vector3f acceleration) Alter this body's gravitational acceleration.abstract void
setMass
(float mass) Alter this body's total mass.abstract void
setPhysicsLocation
(Vector3f location) Directly relocate this body's center.Methods inherited from class com.jme3.bullet.collision.PhysicsCollisionObject
activate, addCollideWithGroup, addToIgnoreList, attachCollisionShape, boundingBox, clearIgnoreList, collisionFlags, copyPcoProperties, countIgnored, finalizeNative, findInstance, getActivationState, getAnisotropicFriction, getCcdMotionThreshold, getCcdSquareMotionThreshold, getCcdSweptSphereRadius, getCollideWithGroups, getCollisionGroup, getCollisionShape, getCollisionSpace, getContactDamping, getContactProcessingThreshold, getContactStiffness, getDeactivationTime, getFriction, getInternalType, getPhysicsLocation, getPhysicsLocationDp, getPhysicsRotation, getPhysicsRotationDp, getPhysicsRotationMatrix, getPhysicsRotationMatrixDp, getRestitution, getRollingFriction, getScale, getSpinningFriction, getTransform, getTransformDp, getUserObject, hasAnisotropicFriction, ignores, initUserPointer, isActive, isContactResponse, isInWorld, isStatic, listIgnoredPcos, proxyGroup, proxyMask, removeCollideWithGroup, removeFromIgnoreList, setActivationState, setAnisotropicFriction, setCcdMotionThreshold, setCcdSweptSphereRadius, setCollideWithGroups, setCollisionFlags, setCollisionGroup, setCollisionShape, setContactDamping, setContactProcessingThreshold, setContactStiffness, setDeactivationTime, setFriction, setIgnoreList, setLocationAndBasis, setRestitution, setRollingFriction, setSpinningFriction, setUserIndex, setUserIndex2, setUserIndex3, setUserObject, spaceId, toString, userIndex, userIndex2, userIndex3
Methods 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)
-
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
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
-
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
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
Directly relocate this body's center.- Parameters:
location
- the desired location (in physics-space coordinates, not null, unaffected)
-