Interface ConstBody
- All Superinterfaces:
Comparable<ConstJoltPhysicsObject>,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.Return the net force acting on the body.Return the net torque acting on the body.booleanTest whether the body is allowed to fall asleep.Return the body's angular velocity.Convert the body to aBodyCreationSettingsobject.Return the location of the body's center of mass (which might not coincide with its origin).floatReturn the body's friction ratio.getId()Access the body's ID for use withBodyInterface.Return the body's linear velocity.Return the body's motion type.intReturn the body's object layer.Return the location of the body's origin (which might not coincide with its center of mass).floatReturn the body's restitution ratio.Return the body's orientation.getShape()Access the body's shape.longReturn the body's user data: can be used for anything.Access the body's bounding box.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.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, va
-
Method Details
-
canBeKinematicOrDynamic
boolean canBeKinematicOrDynamic()Test whether the body could be made kinematic or dynamic. The body is unaffected.- Returns:
- true if possible, otherwise false
-
getAccumulatedForce
Vec3 getAccumulatedForce()Return the net force acting on the body. The body is unaffected.- Returns:
- a new force vector (Newtons in system coordinates)
-
getAccumulatedTorque
Vec3 getAccumulatedTorque()Return 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, otherwise false
-
getAngularVelocity
Vec3 getAngularVelocity()Return 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 aBodyCreationSettingsobject.- Returns:
- a new object
-
getCenterOfMassPosition
RVec3 getCenterOfMassPosition()Return 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)
-
getFriction
float getFriction()Return the body's friction ratio. The body is unaffected.- Returns:
- the ratio
-
getId
ConstBodyId getId()Access the body's ID for use withBodyInterface. The body is unaffected.- Returns:
- a new immutable JVM object with the pre-existing native object assigned
-
getLinearVelocity
Vec3 getLinearVelocity()Return the body's linear velocity. The body is unaffected.- Returns:
- a new velocity vector (meters per second in system coordinates)
-
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()Return 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)
-
getRestitution
float getRestitution()Return the body's restitution ratio. The body is unaffected.- Returns:
- the value (typically ≥0 and ≤1)
-
getRotation
Quat getRotation()Return 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
nullif none
-
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
-
isActive
boolean isActive()Test whether the body is deactivated. The body is unaffected.- Returns:
- false if deactivated, otherwise true
-
isDynamic
boolean isDynamic()Test whether the body is dynamic. The body is unaffected.- Returns:
- true if dynamic, otherwise false
-
isInBroadPhase
boolean isInBroadPhase()Test whether the body has been added to itsPhysicsSystem. The body is unaffected.- Returns:
- true if added, otherwise false
-
isKinematic
boolean isKinematic()Test whether the body is kinematic. It is unaffected.- Returns:
- true if kinematic, otherwise false
-
isRigidBody
boolean isRigidBody()Test whether the body is a rigid body. It is unaffected.- Returns:
- true if rigid body, otherwise false
-
isSensor
boolean isSensor()Test whether the body is a sensor. The body is unaffected.- Returns:
- true if a sensor, otherwise false
-
isStatic
boolean isStatic()Test whether the body is static (non-moving). It is unaffected.- Returns:
- true if static, otherwise false
-