Interface ConstBody
- All Superinterfaces:
Comparable<JoltPhysicsObject>
,ConstJoltPhysicsObject
- All Known Implementing Classes:
Body
Read-only access to a
Body
. (native type: const Body)-
Method Summary
Modifier and TypeMethodDescriptionboolean
Test whether the body could be made kinematic or dynamic.Copy the net force acting on the body.Copy the net torque acting on the body.boolean
Test whether the body is allowed to fall asleep.Copy the body's angular velocity.Convert the body to aBodyCreationSettings
object.Return the body type (rigid or soft).int
Return the broadphase layer.Copy the location of the body's center of mass (which might not coincide with its origin).void
getCenterOfMassPosition
(RVec3 storeLocation) Copy the location of the body's center of mass (which might not coincide with its origin).Copy the coordinate transform of the body's center of mass.Access the body's collision group.boolean
Test whether extra effort should be made to remove ghost contacts.float
Return the body's friction ratio.int
getId()
Return the body's ID for use withBodyInterface
.Copy the inverse coordinate transform of the body's center of mass.Copy the body's linear velocity.Access the body's motion properties.Return the body's motion type.int
Return the body's object layer.Copy the location of the body's origin (which might not coincide with its center of mass).void
getPositionAndRotation
(RVec3 storeLocation, Quat storeOrientation) Copy the position of the body.float
Return the body's restitution ratio.Copy the body's orientation.getShape()
Access the body's shape.Convert the body to aSoftBodyCreationSettings
object.Convert the body to aTransformedShape
object.long
Return the body's user data: can be used for anything.Access the body's bounding box.getWorldSpaceSurfaceNormal
(int subShapeId, RVec3Arg location) Copy the surface normal of the specified sub-shape at the specified location.Copy the world transform.boolean
isActive()
Test whether the body is deactivated.boolean
Test whether the body is dynamic.boolean
Test whether the body has been added to itsPhysicsSystem
.boolean
Test whether the body is kinematic.boolean
Test whether the body is a rigid body.boolean
isSensor()
Test whether the body is a sensor.boolean
Test whether the body is soft.boolean
isStatic()
Test whether the body is static (non-moving).Methods inherited from interface java.lang.Comparable
compareTo
Methods inherited from interface com.github.stephengold.joltjni.readonly.ConstJoltPhysicsObject
close, hasAssignedNativeObject, ownsNativeObject, targetVa
-
Method Details
-
canBeKinematicOrDynamic
boolean canBeKinematicOrDynamic()Test whether the body could be made kinematic or dynamic. The body is unaffected.- Returns:
true
if possible, otherwisefalse
-
getAccumulatedForce
Vec3 getAccumulatedForce()Copy the net force acting on the body. The body is unaffected.- Returns:
- a new force vector (Newtons in system coordinates)
-
getAccumulatedTorque
Vec3 getAccumulatedTorque()Copy the net torque acting on the body. The body is unaffected.- Returns:
- a new torque vector (Newton.meters in system coordinates)
-
getAllowSleeping
boolean getAllowSleeping()Test whether the body is allowed to fall asleep. The body is unaffected.- Returns:
true
if allowed, otherwisefalse
-
getAngularVelocity
Vec3 getAngularVelocity()Copy the body's angular velocity. The body is unaffected.- Returns:
- a new velocity vector (radians per second in system coordinates)
-
getBodyCreationSettings
BodyCreationSettings getBodyCreationSettings()Convert the body to aBodyCreationSettings
object. The body is unaffected.- Returns:
- a new object
-
getBodyType
EBodyType getBodyType()Return the body type (rigid or soft). The body is unaffected.- Returns:
- an enum value (not null)
-
getBroadPhaseLayer
int getBroadPhaseLayer()Return the broadphase layer. The body is unaffected.- Returns:
- the layer ID
-
getCenterOfMassPosition
RVec3 getCenterOfMassPosition()Copy the location of the body's center of mass (which might not coincide with its origin). The body is unaffected.- Returns:
- a new location vector (in system coordinates, all components finite)
-
getCenterOfMassPosition
Copy the location of the body's center of mass (which might not coincide with its origin). The body is unaffected.- Parameters:
storeLocation
- storage for the location (in system coordinates, not null, modified)
-
getCenterOfMassTransform
RMat44 getCenterOfMassTransform()Copy the coordinate transform of the body's center of mass. The body is unaffected.- Returns:
- a new transform matrix (relative to system coordinates)
-
getCollisionGroup
ConstCollisionGroup getCollisionGroup()Access the body's collision group.- Returns:
- a new JVM object with the pre-existing native object assigned
-
getEnhancedInternalEdgeRemoval
boolean getEnhancedInternalEdgeRemoval()Test whether extra effort should be made to remove ghost contacts. The body is unaffected.- Returns:
true
for extra effort, otherwisefalse
-
getFriction
float getFriction()Return the body's friction ratio. The body is unaffected.- Returns:
- the ratio
-
getId
int getId()Return the body's ID for use withBodyInterface
. The body is unaffected.- Returns:
- the
BodyID
value
-
getInverseCenterOfMassTransform
RMat44 getInverseCenterOfMassTransform()Copy the inverse coordinate transform of the body's center of mass. The body is unaffected.- Returns:
- a new transform matrix (relative to local coordinates)
-
getLinearVelocity
Vec3 getLinearVelocity()Copy the body's linear velocity. The body is unaffected.- Returns:
- a new velocity vector (meters per second in system coordinates)
-
getMotionProperties
ConstMotionProperties getMotionProperties()Access the body's motion properties.- Returns:
- a new JVM object with the pre-existing native object assigned, or
null
if none
-
getMotionType
EMotionType getMotionType()Return the body's motion type. The body is unaffected.- Returns:
- an enum value (not null)
-
getObjectLayer
int getObjectLayer()Return the body's object layer. The body is unaffected.- Returns:
- a layer index (≥0)
-
getPosition
RVec3 getPosition()Copy the location of the body's origin (which might not coincide with its center of mass). The body is unaffected.- Returns:
- a new location vector (in system coordinates, all components finite)
-
getPositionAndRotation
Copy the position of the body. The body is unaffected.- Parameters:
storeLocation
- storage for the location (in system coordinates, not null, modified)storeOrientation
- storage for the orientation (in system coordinates, not null, modified)
-
getRestitution
float getRestitution()Return the body's restitution ratio. The body is unaffected.- Returns:
- the value (typically ≥0 and ≤1)
-
getRotation
Quat getRotation()Copy the body's orientation. The body is unaffected.- Returns:
- a new rotation quaternion (relative to the system axes)
-
getShape
ConstShape getShape()Access the body's shape.- Returns:
- a new immutable JVM object with the pre-existing native object
assigned, or
null
if none
-
getSoftBodyCreationSettings
SoftBodyCreationSettings getSoftBodyCreationSettings()Convert the body to aSoftBodyCreationSettings
object. The body is unaffected.- Returns:
- a new object
-
getTransformedShape
TransformedShape getTransformedShape()Convert the body to aTransformedShape
object. The body is unaffected.- Returns:
- a new object
-
getUserData
long getUserData()Return the body's user data: can be used for anything. The body is unaffected.- Returns:
- the value
-
getWorldSpaceBounds
ConstAaBox getWorldSpaceBounds()Access the body's bounding box. The body is unaffected.- Returns:
- a new immutable JVM object with the pre-existing native object assigned
-
getWorldSpaceSurfaceNormal
Copy the surface normal of the specified sub-shape at the specified location. The body is unaffected.- Parameters:
subShapeId
- the ID of the sub-shape to uselocation
- the location to use (not null, unaffected)- Returns:
- a new direction vector
-
getWorldTransform
RMat44 getWorldTransform()Copy the world transform. The body is unaffected.- Returns:
- a new matrix relative to system coordinates
-
isActive
boolean isActive()Test whether the body is deactivated. The body is unaffected.- Returns:
false
if deactivated, otherwisetrue
-
isDynamic
boolean isDynamic()Test whether the body is dynamic. The body is unaffected.- Returns:
true
if dynamic, otherwisefalse
-
isInBroadPhase
boolean isInBroadPhase()Test whether the body has been added to itsPhysicsSystem
. The body is unaffected.- Returns:
true
if added, otherwisefalse
-
isKinematic
boolean isKinematic()Test whether the body is kinematic. It is unaffected.- Returns:
true
if kinematic, otherwisefalse
-
isRigidBody
boolean isRigidBody()Test whether the body is a rigid body. It is unaffected.- Returns:
true
if rigid body, otherwisefalse
-
isSensor
boolean isSensor()Test whether the body is a sensor. It is unaffected.- Returns:
true
if a sensor, otherwisefalse
-
isSoftBody
boolean isSoftBody()Test whether the body is soft. It is unaffected.- Returns:
true
if soft, otherwisefalse
-
isStatic
boolean isStatic()Test whether the body is static (non-moving). It is unaffected.- Returns:
true
if static, otherwisefalse
-