public class PhysicsCharacter extends PhysicsCollisionObject
Modifier and Type | Field and Description |
---|---|
protected com.bulletphysics.dynamics.character.KinematicCharacterController |
character |
protected float |
fallSpeed |
protected com.bulletphysics.collision.dispatch.PairCachingGhostObject |
gObject |
protected float |
jumpSpeed |
protected boolean |
locationDirty |
protected float |
stepHeight |
protected Quaternion |
tmp_inverseWorldRotation |
protected int |
upAxis |
protected Vector3f |
walkDirection |
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
Modifier | Constructor and Description |
---|---|
protected |
PhysicsCharacter() |
|
PhysicsCharacter(CollisionShape shape,
float stepHeight) |
Modifier and Type | Method and Description |
---|---|
protected void |
buildObject() |
void |
destroy() |
float |
getCcdMotionThreshold() |
float |
getCcdSquareMotionThreshold() |
float |
getCcdSweptSphereRadius() |
com.bulletphysics.dynamics.character.KinematicCharacterController |
getControllerId()
used internally
|
float |
getFallSpeed() |
float |
getGravity() |
float |
getJumpSpeed() |
float |
getMaxSlope() |
com.bulletphysics.collision.dispatch.PairCachingGhostObject |
getObjectId()
used internally
|
Vector3f |
getPhysicsLocation() |
Vector3f |
getPhysicsLocation(Vector3f trans) |
int |
getUpAxis() |
Vector3f |
getWalkDirection() |
boolean |
isContactResponse()
Test whether this body responds to contacts.
|
void |
jump() |
boolean |
onGround() |
void |
read(JmeImporter importer) |
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 |
setContactResponse(boolean newState)
Enable/disable this body's contact response.
|
void |
setFallSpeed(float fallSpeed) |
void |
setGravity(float value)
Alter the character's gravitational acceleration without altering its
"up" vector.
|
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) |
addCollideWithGroup, getCollideWithGroups, getCollisionGroup, getCollisionShape, getUserObject, removeCollideWithGroup, setCollideWithGroups, setCollisionGroup, setUserObject
protected com.bulletphysics.dynamics.character.KinematicCharacterController character
protected float stepHeight
protected Vector3f walkDirection
protected float fallSpeed
protected float jumpSpeed
protected int upAxis
protected com.bulletphysics.collision.dispatch.PairCachingGhostObject gObject
protected boolean locationDirty
protected final Quaternion tmp_inverseWorldRotation
protected PhysicsCharacter()
public PhysicsCharacter(CollisionShape shape, float stepHeight)
shape
- The CollisionShape (no Mesh or CompoundCollisionShapes)stepHeight
- The quantization size for vertical movementprotected void buildObject()
public void warp(Vector3f location)
location
- the desired physics location (not null, unaffected)public void setWalkDirection(Vector3f vec)
vec
- the walk direction to setpublic Vector3f getWalkDirection()
public void setUpAxis(int axis)
public int getUpAxis()
public void setFallSpeed(float fallSpeed)
public float getFallSpeed()
public void setJumpSpeed(float jumpSpeed)
public float getJumpSpeed()
public void setGravity(float value)
value
- the desired downward acceleration (in physics-space units
per second squared, default=29.4)public float getGravity()
public void setMaxSlope(float slopeRadians)
public float getMaxSlope()
public void setContactResponse(boolean newState)
newState
- true to respond to contacts (default=true)public boolean isContactResponse()
public boolean onGround()
public void jump()
public void setCollisionShape(CollisionShape collisionShape)
PhysicsCollisionObject
setCollisionShape
in class PhysicsCollisionObject
collisionShape
- the CollisionShape to setpublic void setPhysicsLocation(Vector3f location)
location
- the location of the actual physics objectpublic Vector3f getPhysicsLocation(Vector3f trans)
trans
- storage for the result (modified if not null)public Vector3f getPhysicsLocation()
public void setCcdSweptSphereRadius(float radius)
public void setCcdMotionThreshold(float threshold)
public float getCcdSweptSphereRadius()
public float getCcdMotionThreshold()
public float getCcdSquareMotionThreshold()
public com.bulletphysics.dynamics.character.KinematicCharacterController getControllerId()
public com.bulletphysics.collision.dispatch.PairCachingGhostObject getObjectId()
public void destroy()
public void write(JmeExporter e) throws java.io.IOException
write
in interface Savable
write
in class PhysicsCollisionObject
java.io.IOException
public void read(JmeImporter importer) throws java.io.IOException
read
in interface Savable
read
in class PhysicsCollisionObject
java.io.IOException