com.jme3.bullet.objects
Class PhysicsCharacter

java.lang.Object
  extended by com.jme3.bullet.collision.PhysicsCollisionObject
      extended by com.jme3.bullet.objects.PhysicsCharacter
All Implemented Interfaces:
Savable
Direct Known Subclasses:
CharacterControl

public class PhysicsCharacter
extends PhysicsCollisionObject

Basic Bullet Character


Field Summary
protected  long characterId
           
protected  float fallSpeed
           
protected  float jumpSpeed
           
protected  boolean locationDirty
           
protected  float stepHeight
           
protected  Quaternion tmp_inverseWorldRotation
           
protected  int upAxis
           
protected  Vector3f 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
PhysicsCharacter()
           
PhysicsCharacter(CollisionShape shape, float stepHeight)
           
 
Method Summary
protected  void buildObject()
           
 void destroy()
           
protected  void finalize()
           
 float getCcdMotionThreshold()
           
 float getCcdSquareMotionThreshold()
           
 float getCcdSweptSphereRadius()
           
 long getControllerId()
          used internally
 float getFallSpeed()
           
 float getGravity()
           
 float getJumpSpeed()
           
 float getMaxSlope()
           
 Vector3f getPhysicsLocation()
           
 Vector3f getPhysicsLocation(Vector3f trans)
           
 int getUpAxis()
           
 Vector3f getWalkDirection()
           
 void jump()
           
 boolean onGround()
           
 void read(JmeImporter e)
           
 void setCcdMotionThreshold(float threshold)
           
 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 setFallSpeed(float fallSpeed)
           
 void setGravity(float value)
           
 void setJumpSpeed(float jumpSpeed)
           
 void setMaxSlope(float slopeRadians)
           
 void setPhysicsLocation(Vector3f location)
          Set the physics location (same as warp())
 void setUpAxis(int axis)
           
 void setWalkDirection(Vector3f vec)
          Set the walk direction, works continuously.
 void warp(Vector3f location)
          Sets the location of this physics character
 void write(JmeExporter e)
           
 
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

characterId

protected long characterId

stepHeight

protected float stepHeight

walkDirection

protected Vector3f walkDirection

fallSpeed

protected float fallSpeed

jumpSpeed

protected float jumpSpeed

upAxis

protected int upAxis

locationDirty

protected boolean locationDirty

tmp_inverseWorldRotation

protected final Quaternion tmp_inverseWorldRotation
Constructor Detail

PhysicsCharacter

public PhysicsCharacter()

PhysicsCharacter

public PhysicsCharacter(CollisionShape shape,
                        float stepHeight)
Parameters:
shape - The CollisionShape (no Mesh or CompoundCollisionShapes)
stepHeight - The quantization size for vertical movement
Method Detail

buildObject

protected void buildObject()

warp

public void warp(Vector3f location)
Sets the location of this physics character

Parameters:
location -

setWalkDirection

public void setWalkDirection(Vector3f vec)
Set the walk direction, works continuously. This should probably be called setPositionIncrementPerSimulatorStep. This is neither a direction nor a velocity, but the amount to increment the position each physics tick. So vector length = accuracy*speed in m/s

Parameters:
vec - the walk direction to set

getWalkDirection

public Vector3f getWalkDirection()
Returns:
the currently set walkDirection

setUpAxis

public void setUpAxis(int axis)

getUpAxis

public int getUpAxis()

setFallSpeed

public void setFallSpeed(float fallSpeed)

getFallSpeed

public float getFallSpeed()

setJumpSpeed

public void setJumpSpeed(float jumpSpeed)

getJumpSpeed

public float getJumpSpeed()

setGravity

public void setGravity(float value)

getGravity

public float getGravity()

setMaxSlope

public void setMaxSlope(float slopeRadians)

getMaxSlope

public float getMaxSlope()

onGround

public boolean onGround()

jump

public void jump()

setCollisionShape

public void setCollisionShape(CollisionShape collisionShape)
Description copied from class: PhysicsCollisionObject
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.

Overrides:
setCollisionShape in class PhysicsCollisionObject
Parameters:
collisionShape - the CollisionShape to set

setPhysicsLocation

public void setPhysicsLocation(Vector3f location)
Set the physics location (same as warp())

Parameters:
location - the location of the actual physics object

getPhysicsLocation

public Vector3f getPhysicsLocation(Vector3f trans)
Returns:
the physicsLocation

getPhysicsLocation

public Vector3f getPhysicsLocation()
Returns:
the physicsLocation

setCcdSweptSphereRadius

public void setCcdSweptSphereRadius(float radius)

setCcdMotionThreshold

public void setCcdMotionThreshold(float threshold)

getCcdSweptSphereRadius

public float getCcdSweptSphereRadius()

getCcdMotionThreshold

public float getCcdMotionThreshold()

getCcdSquareMotionThreshold

public float getCcdSquareMotionThreshold()

getControllerId

public long getControllerId()
used internally


destroy

public void destroy()

write

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

read

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

finalize

protected void finalize()
                 throws java.lang.Throwable
Overrides:
finalize in class PhysicsCollisionObject
Throws:
java.lang.Throwable