Interface ConstBody
- All Superinterfaces:
AutoCloseable,Comparable<JoltPhysicsObject>,ConstJoltPhysicsObject
- All Known Implementing Classes:
Body
Read-only access to a
Body. (native type: const Body)-
Method Summary
Modifier and TypeMethodDescriptionbooleanTest 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.booleanTest whether the body is allowed to fall asleep.Copy the body's angular velocity.Generate settings to reconstruct the (rigid) body.Return the body type (rigid or soft).intReturn the broadphase layer.Copy the location of the body's center of mass (which might not coincide with its origin).voidgetCenterOfMassPosition(RVec3 storeLocation) Copy the location of the body's center of mass (which might not coincide with its origin).voidgetCenterOfMassPosition(DoubleBuffer storeResult) 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.booleanTest whether extra effort should be made to remove ghost contacts.floatReturn the body's friction ratio.intgetId()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.intReturn the body's object layer.Copy the location of the body's origin (which might not coincide with its center of mass).voidgetPositionAndRotation(RVec3 storeLocation, Quat storeOrientation) Copy the position of the body.floatReturn the body's restitution ratio.Copy the body's orientation.getShape()Access the body's shape.voidUpdate the specified counted reference to refer to the body's shape.Generate settings to reconstruct the (soft) body.Convert the body to aTransformedShapeobject.longReturn 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 a particular subshape at the specified location.Copy the world transform.booleanisActive()Test whether the body is deactivated.booleanTest whether the body is dynamic.booleanTest whether the body has been added to itsPhysicsSystem.booleanTest whether the body is kinematic.booleanTest whether the body is a rigid body.booleanisSensor()Test whether the body is a sensor.booleanTest whether the body is soft.booleanisStatic()Test whether the body is static (non-moving).Methods inherited from interface java.lang.Comparable
compareToMethods 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:
trueif 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:
trueif 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()Generate settings to reconstruct the (rigid) body. 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:
storeResult- storage for the location in system coordinates (not null, modified)
-
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:
truefor 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
BodyIDvalue
-
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
nullif 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. The body is unaffected.- Returns:
- a new immutable JVM object with the pre-existing native object
assigned, or
nullif none
-
getShape
Update the specified counted reference to refer to the body's shape. The body is unaffected.- Parameters:
storeRef- storage for the reference (notnull, modified)
-
getSoftBodyCreationSettings
SoftBodyCreationSettings getSoftBodyCreationSettings()Generate settings to reconstruct the (soft) body. The body is unaffected.- Returns:
- a new object
-
getTransformedShape
TransformedShape getTransformedShape()Convert the body to aTransformedShapeobject. 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 a particular subshape 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:
falseif deactivated, otherwisetrue
-
isDynamic
boolean isDynamic()Test whether the body is dynamic. The body is unaffected.- Returns:
trueif dynamic, otherwisefalse
-
isInBroadPhase
boolean isInBroadPhase()Test whether the body has been added to itsPhysicsSystem. The body is unaffected.- Returns:
trueif added, otherwisefalse
-
isKinematic
boolean isKinematic()Test whether the body is kinematic. It is unaffected.- Returns:
trueif kinematic, otherwisefalse
-
isRigidBody
boolean isRigidBody()Test whether the body is a rigid body. It is unaffected.- Returns:
trueif rigid body, otherwisefalse
-
isSensor
boolean isSensor()Test whether the body is a sensor. It is unaffected.- Returns:
trueif a sensor, otherwisefalse
-
isSoftBody
boolean isSoftBody()Test whether the body is soft. It is unaffected.- Returns:
trueif soft, otherwisefalse
-
isStatic
boolean isStatic()Test whether the body is static (non-moving). It is unaffected.- Returns:
trueif static, otherwisefalse
-