com.jme3.bullet.control
Class RigidBodyControl

java.lang.Object
  extended by com.jme3.bullet.collision.PhysicsCollisionObject
      extended by com.jme3.bullet.objects.PhysicsRigidBody
          extended by com.jme3.bullet.control.RigidBodyControl
All Implemented Interfaces:
PhysicsControl, Savable, Control

public class RigidBodyControl
extends PhysicsRigidBody
implements PhysicsControl


Field Summary
protected  boolean added
           
protected  boolean enabled
           
protected  boolean kinematicSpatial
           
protected  PhysicsSpace space
           
protected  Spatial spatial
           
 
Fields inherited from class com.jme3.bullet.objects.PhysicsRigidBody
joints, kinematic, mass, motionState
 
Fields inherited from class com.jme3.bullet.collision.PhysicsCollisionObject
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, debugArrow, debugArrowGeom, debugMaterialBlue, debugMaterialGreen, debugMaterialRed, debugMaterialYellow, debugShape, objectId
 
Constructor Summary
RigidBodyControl()
           
RigidBodyControl(CollisionShape shape)
          Creates a new PhysicsNode with the supplied collision shape and mass 1
RigidBodyControl(CollisionShape shape, float mass)
           
RigidBodyControl(float mass)
          When using this constructor, the CollisionShape for the RigidBody is generated automatically when the Control is added to a Spatial.
 
Method Summary
 Control cloneForSpatial(Spatial spatial)
          Creates a clone of the Control, the given Spatial is the cloned version of the spatial to which this control is attached to.
protected  void createCollisionShape()
           
 PhysicsSpace getPhysicsSpace()
           
 boolean isApplyPhysicsLocal()
           
 boolean isEnabled()
           
 boolean isKinematicSpatial()
          Checks if this control is in kinematic spatial mode.
 void read(JmeImporter im)
           
 void render(RenderManager rm, ViewPort vp)
          Should be called prior to queuing the spatial by the RenderManager.
 void setApplyPhysicsLocal(boolean applyPhysicsLocal)
          When set to true, the physics coordinates will be applied to the local translation of the Spatial instead of the world traslation.
 void setEnabled(boolean enabled)
          The physics object is removed from the physics space when the control is disabled.
 void setKinematicSpatial(boolean kinematicSpatial)
          Sets this control to kinematic spatial mode so that the spatials transform will be applied to the rigidbody in kinematic mode, defaults to true.
 void setPhysicsSpace(PhysicsSpace space)
           
 void setSpatial(Spatial spatial)
           
 void update(float tpf)
          Updates the control.
 void write(JmeExporter ex)
           
 
Methods inherited from class com.jme3.bullet.objects.PhysicsRigidBody
activate, addJoint, applyCentralForce, applyForce, applyImpulse, applyTorque, applyTorqueImpulse, clearForces, getAngularDamping, getAngularFactor, getAngularSleepingThreshold, getAngularVelocity, getAngularVelocity, getCcdMotionThreshold, getCcdSquareMotionThreshold, getCcdSweptSphereRadius, getDebugShape, getFriction, getGravity, getGravity, getJoints, getLinearDamping, getLinearSleepingThreshold, getLinearVelocity, getLinearVelocity, getMass, getMotionState, getPhysicsLocation, getPhysicsLocation, getPhysicsRotation, getPhysicsRotation, getPhysicsRotationMatrix, getPhysicsRotationMatrix, getRestitution, isActive, isInWorld, isKinematic, postRebuild, preRebuild, rebuildRigidBody, removeJoint, setAngularDamping, setAngularFactor, setAngularSleepingThreshold, setAngularVelocity, setCcdMotionThreshold, setCcdSweptSphereRadius, setCollisionShape, setDamping, setFriction, setGravity, setKinematic, setLinearDamping, setLinearSleepingThreshold, setLinearVelocity, setMass, setPhysicsLocation, setPhysicsRotation, setPhysicsRotation, setRestitution, setSleepingThresholds
 
Methods inherited from class com.jme3.bullet.collision.PhysicsCollisionObject
addCollideWithGroup, attachCollisionShape, attachDebugShape, attachDebugShape, attachDebugShape, createDebugShape, debugShape, detachDebugShape, finalize, finalizeNative, getCollideWithGroups, getCollisionGroup, getCollisionShape, getObjectId, getUserObject, initUserPointer, removeCollideWithGroup, setCollideWithGroups, setCollisionGroup, setUserObject, updateDebugShape
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

spatial

protected Spatial spatial

enabled

protected boolean enabled

added

protected boolean added

space

protected PhysicsSpace space

kinematicSpatial

protected boolean kinematicSpatial
Constructor Detail

RigidBodyControl

public RigidBodyControl()

RigidBodyControl

public RigidBodyControl(float mass)
When using this constructor, the CollisionShape for the RigidBody is generated automatically when the Control is added to a Spatial.

Parameters:
mass - When not 0, a HullCollisionShape is generated, otherwise a MeshCollisionShape is used. For geometries with box or sphere meshes the proper box or sphere collision shape is used.

RigidBodyControl

public RigidBodyControl(CollisionShape shape)
Creates a new PhysicsNode with the supplied collision shape and mass 1

Parameters:
shape -

RigidBodyControl

public RigidBodyControl(CollisionShape shape,
                        float mass)
Method Detail

cloneForSpatial

public Control cloneForSpatial(Spatial spatial)
Description copied from interface: Control
Creates a clone of the Control, the given Spatial is the cloned version of the spatial to which this control is attached to.

Specified by:
cloneForSpatial in interface Control
Returns:
A clone of this control for the spatial

setSpatial

public void setSpatial(Spatial spatial)
Specified by:
setSpatial in interface Control
Parameters:
spatial - the spatial to be controlled. This should not be called from user code.

createCollisionShape

protected void createCollisionShape()

setEnabled

public void setEnabled(boolean enabled)
Description copied from interface: PhysicsControl
The physics object is removed from the physics space when the control is disabled. When the control is enabled again the physics object is moved to the current location of the spatial and then added to the physics space. This allows disabling/enabling physics to move the spatial freely.

Specified by:
setEnabled in interface PhysicsControl

isEnabled

public boolean isEnabled()

isKinematicSpatial

public boolean isKinematicSpatial()
Checks if this control is in kinematic spatial mode.

Returns:
true if the spatial location is applied to this kinematic rigidbody

setKinematicSpatial

public void setKinematicSpatial(boolean kinematicSpatial)
Sets this control to kinematic spatial mode so that the spatials transform will be applied to the rigidbody in kinematic mode, defaults to true.

Parameters:
kinematicSpatial -

isApplyPhysicsLocal

public boolean isApplyPhysicsLocal()

setApplyPhysicsLocal

public void setApplyPhysicsLocal(boolean applyPhysicsLocal)
When set to true, the physics coordinates will be applied to the local translation of the Spatial instead of the world traslation.

Parameters:
applyPhysicsLocal -

update

public void update(float tpf)
Description copied from interface: Control
Updates the control. This should not be called from user code.

Specified by:
update in interface Control
Parameters:
tpf - Time per frame.

render

public void render(RenderManager rm,
                   ViewPort vp)
Description copied from interface: Control
Should be called prior to queuing the spatial by the RenderManager. This should not be called from user code.

Specified by:
render in interface Control

setPhysicsSpace

public void setPhysicsSpace(PhysicsSpace space)
Specified by:
setPhysicsSpace in interface PhysicsControl

getPhysicsSpace

public PhysicsSpace getPhysicsSpace()
Specified by:
getPhysicsSpace in interface PhysicsControl

write

public void write(JmeExporter ex)
           throws java.io.IOException
Specified by:
write in interface Savable
Overrides:
write in class PhysicsRigidBody
Throws:
java.io.IOException

read

public void read(JmeImporter im)
          throws java.io.IOException
Specified by:
read in interface Savable
Overrides:
read in class PhysicsRigidBody
Throws:
java.io.IOException