com.jme3.bullet.control
Class CharacterControl

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

public class CharacterControl
extends PhysicsCharacter
implements PhysicsControl


Field Summary
protected  boolean added
           
protected  boolean applyLocal
           
protected  boolean enabled
           
protected  PhysicsSpace space
           
protected  Spatial spatial
           
protected  boolean useViewDirection
           
protected  Vector3f viewDirection
           
 
Fields inherited from class com.jme3.bullet.objects.PhysicsCharacter
characterId, fallSpeed, jumpSpeed, locationDirty, stepHeight, tmp_inverseWorldRotation, upAxis, walkDirection
 
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
CharacterControl()
           
CharacterControl(CollisionShape shape, float stepHeight)
           
 
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.
 PhysicsSpace getPhysicsSpace()
           
 Vector3f getViewDirection()
           
 boolean isApplyPhysicsLocal()
           
 boolean isEnabled()
           
 boolean isUseViewDirection()
           
 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
 void setEnabled(boolean enabled)
          The physics object is removed from the physics space when the control is disabled.
 void setPhysicsSpace(PhysicsSpace space)
           
 void setSpatial(Spatial spatial)
           
 void setUseViewDirection(boolean viewDirectionEnabled)
           
 void setViewDirection(Vector3f vec)
           
 void update(float tpf)
          Updates the control.
 void write(JmeExporter ex)
           
 
Methods inherited from class com.jme3.bullet.objects.PhysicsCharacter
buildObject, destroy, finalize, getCcdMotionThreshold, getCcdSquareMotionThreshold, getCcdSweptSphereRadius, getControllerId, getFallSpeed, getGravity, getJumpSpeed, getMaxSlope, getPhysicsLocation, getPhysicsLocation, getUpAxis, getWalkDirection, jump, onGround, setCcdMotionThreshold, setCcdSweptSphereRadius, setCollisionShape, setFallSpeed, setGravity, setJumpSpeed, setMaxSlope, setPhysicsLocation, setUpAxis, setWalkDirection, warp
 
Methods inherited from class com.jme3.bullet.collision.PhysicsCollisionObject
addCollideWithGroup, attachCollisionShape, attachDebugShape, attachDebugShape, attachDebugShape, createDebugShape, debugShape, detachDebugShape, finalizeNative, getCollideWithGroups, getCollisionGroup, getCollisionShape, getDebugShape, 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

viewDirection

protected Vector3f viewDirection

useViewDirection

protected boolean useViewDirection

applyLocal

protected boolean applyLocal
Constructor Detail

CharacterControl

public CharacterControl()

CharacterControl

public CharacterControl(CollisionShape shape,
                        float stepHeight)
Method Detail

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

Parameters:
applyPhysicsLocal -

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.

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()

setViewDirection

public void setViewDirection(Vector3f vec)

getViewDirection

public Vector3f getViewDirection()

isUseViewDirection

public boolean isUseViewDirection()

setUseViewDirection

public void setUseViewDirection(boolean viewDirectionEnabled)

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 PhysicsCharacter
Throws:
java.io.IOException

read

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