public class RigidBody extends CollisionObject
CollisionObject, so it keeps reference to CollisionShape.
It is recommended for performance and memory use to share CollisionShape
objects whenever possible.
There are 3 types of rigid bodies:
Deactivated (sleeping) rigid bodies don't take any processing time, except a minor broadphase collision detection impact (to allow active objects to activate/wake up sleeping objects).
| Modifier and Type | Field and Description |
|---|---|
int |
contactSolverType |
int |
debugBodyId |
int |
frictionSolverType |
ACTIVE_TAG, DISABLE_DEACTIVATION, DISABLE_SIMULATION, ISLAND_SLEEPING, WANTS_DEACTIVATION| Constructor and Description |
|---|
RigidBody(float mass,
MotionState motionState,
CollisionShape collisionShape) |
RigidBody(float mass,
MotionState motionState,
CollisionShape collisionShape,
Vector3f localInertia) |
RigidBody(RigidBodyConstructionInfo constructionInfo) |
| Modifier and Type | Method and Description |
|---|---|
void |
addConstraintRef(TypedConstraint c) |
void |
applyCentralForce(Vector3f force) |
void |
applyCentralImpulse(Vector3f impulse) |
void |
applyDamping(float timeStep)
Damps the velocity, using the given linearDamping and angularDamping.
|
void |
applyForce(Vector3f force,
Vector3f rel_pos) |
void |
applyGravity() |
void |
applyImpulse(Vector3f impulse,
Vector3f rel_pos) |
void |
applyTorque(Vector3f torque) |
void |
applyTorqueImpulse(Vector3f torque) |
boolean |
checkCollideWithOverride(CollisionObject co) |
void |
clearForces() |
float |
computeAngularImpulseDenominator(Vector3f axis) |
float |
computeImpulseDenominator(Vector3f pos,
Vector3f normal) |
void |
destroy() |
void |
getAabb(Vector3f aabbMin,
Vector3f aabbMax) |
float |
getAngularDamping() |
float |
getAngularFactor() |
float |
getAngularSleepingThreshold() |
Vector3f |
getAngularVelocity(Vector3f out) |
BroadphaseProxy |
getBroadphaseProxy() |
Vector3f |
getCenterOfMassPosition(Vector3f out) |
Transform |
getCenterOfMassTransform(Transform out) |
TypedConstraint |
getConstraintRef(int index) |
Vector3f |
getGravity(Vector3f out) |
Vector3f |
getInvInertiaDiagLocal(Vector3f out) |
Matrix3f |
getInvInertiaTensorWorld(Matrix3f out) |
float |
getInvMass() |
float |
getLinearDamping() |
float |
getLinearSleepingThreshold() |
Vector3f |
getLinearVelocity(Vector3f out) |
MotionState |
getMotionState() |
int |
getNumConstraintRefs() |
Quat4f |
getOrientation(Quat4f out) |
Vector3f |
getVelocityInLocalPoint(Vector3f rel_pos,
Vector3f out) |
void |
integrateVelocities(float step) |
void |
internalApplyImpulse(Vector3f linearComponent,
Vector3f angularComponent,
float impulseMagnitude)
Optimization for the iterative solver: avoid calculating constant terms involving inertia, normal, relative position.
|
boolean |
isInWorld()
Is this rigidbody added to a CollisionWorld/DynamicsWorld/Broadphase?
|
void |
predictIntegratedTransform(float timeStep,
Transform predictedTransform)
Continuous collision detection needs prediction.
|
void |
proceedToTransform(Transform newTrans) |
void |
removeConstraintRef(TypedConstraint c) |
void |
saveKinematicState(float timeStep) |
void |
setAngularFactor(float angFac) |
void |
setAngularVelocity(Vector3f ang_vel) |
void |
setCenterOfMassTransform(Transform xform) |
void |
setDamping(float lin_damping,
float ang_damping) |
void |
setGravity(Vector3f acceleration) |
void |
setInvInertiaDiagLocal(Vector3f diagInvInertia) |
void |
setLinearVelocity(Vector3f lin_vel) |
void |
setMassProps(float mass,
Vector3f inertia) |
void |
setMotionState(MotionState motionState) |
void |
setNewBroadphaseProxy(BroadphaseProxy broadphaseProxy) |
void |
setSleepingThresholds(float linear,
float angular) |
void |
translate(Vector3f v) |
static RigidBody |
upcast(CollisionObject colObj)
To keep collision detection and dynamics separate we don't store a rigidbody pointer,
but a rigidbody is derived from CollisionObject, so we can safely perform an upcast.
|
void |
updateDeactivation(float timeStep) |
void |
updateInertiaTensor() |
boolean |
wantsSleeping() |
activate, activate, checkCollideWith, forceActivationState, getActivationState, getBroadphaseHandle, getCcdMotionThreshold, getCcdSquareMotionThreshold, getCcdSweptSphereRadius, getCollisionFlags, getCollisionShape, getCompanionId, getDeactivationTime, getFriction, getHitFraction, getInternalType, getInterpolationAngularVelocity, getInterpolationLinearVelocity, getInterpolationWorldTransform, getIslandTag, getRestitution, getRootCollisionShape, getUserPointer, getWorldTransform, hasContactResponse, internalSetTemporaryCollisionShape, isActive, isKinematicObject, isStaticObject, isStaticOrKinematicObject, mergesSimulationIslands, setActivationState, setBroadphaseHandle, setCcdMotionThreshold, setCcdSweptSphereRadius, setCollisionFlags, setCollisionShape, setCompanionId, setDeactivationTime, setFriction, setHitFraction, setInterpolationAngularVelocity, setInterpolationLinearVelocity, setInterpolationWorldTransform, setIslandTag, setRestitution, setUserPointer, setWorldTransformpublic int contactSolverType
public int frictionSolverType
public int debugBodyId
public RigidBody(RigidBodyConstructionInfo constructionInfo)
public RigidBody(float mass,
MotionState motionState,
CollisionShape collisionShape)
public RigidBody(float mass,
MotionState motionState,
CollisionShape collisionShape,
Vector3f localInertia)
public void destroy()
public void proceedToTransform(Transform newTrans)
public static RigidBody upcast(CollisionObject colObj)
public void predictIntegratedTransform(float timeStep,
Transform predictedTransform)
public void saveKinematicState(float timeStep)
public void applyGravity()
public void setGravity(Vector3f acceleration)
public void setDamping(float lin_damping,
float ang_damping)
public float getLinearDamping()
public float getAngularDamping()
public float getLinearSleepingThreshold()
public float getAngularSleepingThreshold()
public void applyDamping(float timeStep)
public void setMassProps(float mass,
Vector3f inertia)
public float getInvMass()
public void integrateVelocities(float step)
public void setCenterOfMassTransform(Transform xform)
public void applyCentralForce(Vector3f force)
public void setInvInertiaDiagLocal(Vector3f diagInvInertia)
public void setSleepingThresholds(float linear,
float angular)
public void applyTorque(Vector3f torque)
public void applyCentralImpulse(Vector3f impulse)
public void applyTorqueImpulse(Vector3f torque)
public void internalApplyImpulse(Vector3f linearComponent, Vector3f angularComponent, float impulseMagnitude)
public void clearForces()
public void updateInertiaTensor()
public void setLinearVelocity(Vector3f lin_vel)
public void setAngularVelocity(Vector3f ang_vel)
public void translate(Vector3f v)
public float computeAngularImpulseDenominator(Vector3f axis)
public void updateDeactivation(float timeStep)
public boolean wantsSleeping()
public BroadphaseProxy getBroadphaseProxy()
public void setNewBroadphaseProxy(BroadphaseProxy broadphaseProxy)
public MotionState getMotionState()
public void setMotionState(MotionState motionState)
public void setAngularFactor(float angFac)
public float getAngularFactor()
public boolean isInWorld()
public boolean checkCollideWithOverride(CollisionObject co)
checkCollideWithOverride in class CollisionObjectpublic void addConstraintRef(TypedConstraint c)
public void removeConstraintRef(TypedConstraint c)
public TypedConstraint getConstraintRef(int index)
public int getNumConstraintRefs()