public class PhysicsRigidBody extends PhysicsCollisionObject
PhysicsRigidBody - Basic physics object
| Modifier and Type | Field and Description |
|---|---|
protected java.util.ArrayList<PhysicsJoint> |
joints |
protected boolean |
kinematic |
protected float |
mass |
protected RigidBodyMotionState |
motionState |
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, collisionGroup, collisionGroupsMask, collisionShape, objectId| Constructor and Description |
|---|
PhysicsRigidBody() |
PhysicsRigidBody(CollisionShape shape)
Creates a new PhysicsRigidBody with the supplied collision shape
|
PhysicsRigidBody(CollisionShape shape,
float mass) |
| Modifier and Type | Method and Description |
|---|---|
void |
activate()
reactivates this PhysicsRigidBody when it has been deactivated because it was not moving
|
void |
addJoint(PhysicsJoint joint)
do not use manually, joints are added automatically
|
void |
applyCentralForce(com.jme3.math.Vector3f force)
Apply a force to the PhysicsRigidBody, only applies force if the next physics update call
updates the physics space.
To apply an impulse, use applyImpulse. |
void |
applyForce(com.jme3.math.Vector3f force,
com.jme3.math.Vector3f location)
Apply a force to the PhysicsRigidBody, only applies force if the next physics update call
updates the physics space.
To apply an impulse, use applyImpulse, use applyContinuousForce to apply continuous force. |
void |
applyImpulse(com.jme3.math.Vector3f impulse,
com.jme3.math.Vector3f rel_pos)
Apply an impulse to the PhysicsRigidBody in the next physics update.
|
void |
applyTorque(com.jme3.math.Vector3f torque)
Apply a force to the PhysicsRigidBody, only applies force if the next physics update call
updates the physics space.
To apply an impulse, use applyImpulse. |
void |
applyTorqueImpulse(com.jme3.math.Vector3f vec)
Apply a torque impulse to the PhysicsRigidBody in the next physics update.
|
void |
clearForces()
Clear all forces from the PhysicsRigidBody
|
float |
getAngularDamping() |
float |
getAngularFactor() |
com.jme3.math.Vector3f |
getAngularFactor(com.jme3.math.Vector3f store) |
float |
getAngularSleepingThreshold() |
com.jme3.math.Vector3f |
getAngularVelocity()
Get the current angular velocity of this PhysicsRigidBody
|
void |
getAngularVelocity(com.jme3.math.Vector3f vec)
Get the current angular velocity of this PhysicsRigidBody
|
float |
getCcdMotionThreshold() |
float |
getCcdSquareMotionThreshold() |
float |
getCcdSweptSphereRadius() |
float |
getFriction() |
com.jme3.math.Vector3f |
getGravity() |
com.jme3.math.Vector3f |
getGravity(com.jme3.math.Vector3f gravity) |
java.util.List<PhysicsJoint> |
getJoints()
Returns a list of connected joints.
|
float |
getLinearDamping() |
com.jme3.math.Vector3f |
getLinearFactor() |
float |
getLinearSleepingThreshold() |
com.jme3.math.Vector3f |
getLinearVelocity()
Get the current linear velocity of this PhysicsRigidBody
|
void |
getLinearVelocity(com.jme3.math.Vector3f vec)
Get the current linear velocity of this PhysicsRigidBody
|
float |
getMass() |
RigidBodyMotionState |
getMotionState() |
com.jme3.math.Vector3f |
getPhysicsLocation() |
com.jme3.math.Vector3f |
getPhysicsLocation(com.jme3.math.Vector3f trans) |
com.jme3.math.Quaternion |
getPhysicsRotation() |
com.jme3.math.Quaternion |
getPhysicsRotation(com.jme3.math.Quaternion rot) |
com.jme3.math.Matrix3f |
getPhysicsRotationMatrix() |
com.jme3.math.Matrix3f |
getPhysicsRotationMatrix(com.jme3.math.Matrix3f rot) |
float |
getRestitution() |
boolean |
isActive() |
boolean |
isInWorld() |
boolean |
isKinematic() |
protected void |
postRebuild() |
protected void |
preRebuild() |
void |
read(com.jme3.export.JmeImporter e) |
protected void |
rebuildRigidBody()
Builds/rebuilds the phyiscs body when parameters have changed
|
void |
removeJoint(PhysicsJoint joint) |
void |
setAngularDamping(float angularDamping) |
void |
setAngularFactor(float factor) |
void |
setAngularFactor(com.jme3.math.Vector3f factor) |
void |
setAngularSleepingThreshold(float angularSleepingThreshold) |
void |
setAngularVelocity(com.jme3.math.Vector3f vec)
Sets the angular velocity of this PhysicsRigidBody
|
void |
setCcdMotionThreshold(float threshold)
Sets the amount of motion that has to happen in one physics tick to trigger the continuous motion detection
This avoids the problem of fast objects moving through other objects, set to zero to disable (default) |
void |
setCcdSweptSphereRadius(float radius) |
void |
setCollisionShape(CollisionShape collisionShape)
Sets a CollisionShape to this physics object, note that the object should
not be in the physics space when adding a new collision shape as it is rebuilt
on the physics side.
|
void |
setDamping(float linearDamping,
float angularDamping) |
void |
setFriction(float friction)
Sets the friction of this physics object
|
void |
setGravity(com.jme3.math.Vector3f gravity)
Set the local gravity of this PhysicsRigidBody
Set this after adding the node to the PhysicsSpace, the PhysicsSpace assigns its current gravity to the physics node when its added. |
void |
setKinematic(boolean kinematic)
Sets the node to kinematic mode.
|
void |
setLinearDamping(float linearDamping) |
void |
setLinearFactor(com.jme3.math.Vector3f factor) |
void |
setLinearSleepingThreshold(float linearSleepingThreshold) |
void |
setLinearVelocity(com.jme3.math.Vector3f vec)
Sets the linear velocity of this PhysicsRigidBody
|
void |
setMass(float mass)
Sets the mass of this PhysicsRigidBody, objects with mass=0 are static.
|
void |
setPhysicsLocation(com.jme3.math.Vector3f location)
Sets the physics object location
|
void |
setPhysicsRotation(com.jme3.math.Matrix3f rotation)
Sets the physics object rotation
|
void |
setPhysicsRotation(com.jme3.math.Quaternion rotation)
Sets the physics object rotation
|
void |
setRestitution(float restitution)
The "bouncyness" of the PhysicsRigidBody, best performance if restitution=0
|
void |
setSleepingThresholds(float linear,
float angular)
sets the sleeping thresholds, these define when the object gets deactivated
to save ressources.
|
void |
write(com.jme3.export.JmeExporter e) |
addCollideWithGroup, attachCollisionShape, finalize, finalizeNative, getCollideWithGroups, getCollisionGroup, getCollisionShape, getObjectId, getUserObject, initUserPointer, removeCollideWithGroup, setCollideWithGroups, setCollisionGroup, setUserObjectprotected RigidBodyMotionState motionState
protected float mass
protected boolean kinematic
protected java.util.ArrayList<PhysicsJoint> joints
public PhysicsRigidBody()
public PhysicsRigidBody(CollisionShape shape)
child - shape - public PhysicsRigidBody(CollisionShape shape, float mass)
protected void rebuildRigidBody()
protected void preRebuild()
protected void postRebuild()
public RigidBodyMotionState getMotionState()
public boolean isInWorld()
public void setPhysicsLocation(com.jme3.math.Vector3f location)
location - the location of the actual physics objectpublic void setPhysicsRotation(com.jme3.math.Matrix3f rotation)
rotation - the rotation of the actual physics objectpublic void setPhysicsRotation(com.jme3.math.Quaternion rotation)
rotation - the rotation of the actual physics objectpublic com.jme3.math.Vector3f getPhysicsLocation(com.jme3.math.Vector3f trans)
public com.jme3.math.Quaternion getPhysicsRotation(com.jme3.math.Quaternion rot)
public com.jme3.math.Matrix3f getPhysicsRotationMatrix(com.jme3.math.Matrix3f rot)
public com.jme3.math.Vector3f getPhysicsLocation()
public com.jme3.math.Quaternion getPhysicsRotation()
public com.jme3.math.Matrix3f getPhysicsRotationMatrix()
public void setKinematic(boolean kinematic)
kinematic - public boolean isKinematic()
public void setCcdSweptSphereRadius(float radius)
public void setCcdMotionThreshold(float threshold)
threshold - public float getCcdSweptSphereRadius()
public float getCcdMotionThreshold()
public float getCcdSquareMotionThreshold()
public float getMass()
public void setMass(float mass)
mass - public com.jme3.math.Vector3f getGravity()
public com.jme3.math.Vector3f getGravity(com.jme3.math.Vector3f gravity)
public void setGravity(com.jme3.math.Vector3f gravity)
gravity - the gravity vector to setpublic float getFriction()
public void setFriction(float friction)
friction - the friction of this physics objectpublic void setDamping(float linearDamping,
float angularDamping)
public void setLinearDamping(float linearDamping)
public void setAngularDamping(float angularDamping)
public float getLinearDamping()
public float getAngularDamping()
public float getRestitution()
public void setRestitution(float restitution)
restitution - public com.jme3.math.Vector3f getAngularVelocity()
public void getAngularVelocity(com.jme3.math.Vector3f vec)
vec - the vector to store the velocity inpublic void setAngularVelocity(com.jme3.math.Vector3f vec)
vec - the angular velocity of this PhysicsRigidBodypublic com.jme3.math.Vector3f getLinearVelocity()
public void getLinearVelocity(com.jme3.math.Vector3f vec)
vec - the vector to store the velocity inpublic void setLinearVelocity(com.jme3.math.Vector3f vec)
vec - the linear velocity of this PhysicsRigidBodypublic void applyForce(com.jme3.math.Vector3f force,
com.jme3.math.Vector3f location)
force - the forcelocation - the location of the forcepublic void applyCentralForce(com.jme3.math.Vector3f force)
force - the forcepublic void applyTorque(com.jme3.math.Vector3f torque)
torque - the torquepublic void applyImpulse(com.jme3.math.Vector3f impulse,
com.jme3.math.Vector3f rel_pos)
impulse - applied impulserel_pos - location relative to objectpublic void applyTorqueImpulse(com.jme3.math.Vector3f vec)
vec - public void clearForces()
public void setCollisionShape(CollisionShape collisionShape)
PhysicsCollisionObjectsetCollisionShape in class PhysicsCollisionObjectcollisionShape - the CollisionShape to setpublic void activate()
public boolean isActive()
public void setSleepingThresholds(float linear,
float angular)
linear - the linear sleeping thresholdangular - the angular sleeping thresholdpublic void setLinearSleepingThreshold(float linearSleepingThreshold)
public void setAngularSleepingThreshold(float angularSleepingThreshold)
public float getLinearSleepingThreshold()
public float getAngularSleepingThreshold()
public float getAngularFactor()
public com.jme3.math.Vector3f getAngularFactor(com.jme3.math.Vector3f store)
public void setAngularFactor(float factor)
public void setAngularFactor(com.jme3.math.Vector3f factor)
public com.jme3.math.Vector3f getLinearFactor()
public void setLinearFactor(com.jme3.math.Vector3f factor)
public void addJoint(PhysicsJoint joint)
public void removeJoint(PhysicsJoint joint)
public java.util.List<PhysicsJoint> getJoints()
public void write(com.jme3.export.JmeExporter e)
throws java.io.IOException
write in interface com.jme3.export.Savablewrite in class PhysicsCollisionObjectjava.io.IOExceptionpublic void read(com.jme3.export.JmeImporter e)
throws java.io.IOException
read in interface com.jme3.export.Savableread in class PhysicsCollisionObjectjava.io.IOException