Package com.jme3.bullet.objects
Class PhysicsCharacter
java.lang.Object
com.jme3.bullet.collision.PhysicsCollisionObject
com.jme3.bullet.objects.PhysicsCharacter
- All Implemented Interfaces:
Savable
- Direct Known Subclasses:
CharacterControl
Basic Bullet Character
-
Field Summary
Modifier and TypeFieldDescriptionprotected com.bulletphysics.dynamics.character.KinematicCharacterController
protected float
protected com.bulletphysics.collision.dispatch.PairCachingGhostObject
protected float
protected boolean
protected float
protected final Quaternion
protected int
protected Vector3f
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
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
void
destroy()
float
float
float
com.bulletphysics.dynamics.character.KinematicCharacterController
used internallyfloat
float
float
float
com.bulletphysics.collision.dispatch.PairCachingGhostObject
used internallygetPhysicsLocation
(Vector3f trans) int
boolean
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
Sets the location of this physics charactervoid
write
(JmeExporter e) Methods inherited from class com.jme3.bullet.collision.PhysicsCollisionObject
addCollideWithGroup, getCollideWithGroups, getCollisionGroup, getCollisionShape, getUserObject, removeCollideWithGroup, setCollideWithGroups, setCollisionGroup, setUserObject
-
Field Details
-
character
protected com.bulletphysics.dynamics.character.KinematicCharacterController character -
stepHeight
protected float stepHeight -
walkDirection
-
fallSpeed
protected float fallSpeed -
jumpSpeed
protected float jumpSpeed -
upAxis
protected int upAxis -
gObject
protected com.bulletphysics.collision.dispatch.PairCachingGhostObject gObject -
locationDirty
protected boolean locationDirty -
tmp_inverseWorldRotation
-
-
Constructor Details
-
PhysicsCharacter
protected PhysicsCharacter() -
PhysicsCharacter
- Parameters:
shape
- The CollisionShape (no Mesh or CompoundCollisionShapes)stepHeight
- The quantization size for vertical movement
-
-
Method Details
-
buildObject
protected void buildObject() -
warp
Sets the location of this physics character- Parameters:
location
- the desired physics location (not null, unaffected)
-
setWalkDirection
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
- 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) Alter the character's gravitational acceleration without altering its "up" vector.- Parameters:
value
- the desired downward acceleration (in physics-space units per second squared, default=29.4)
-
getGravity
public float getGravity() -
setMaxSlope
public void setMaxSlope(float slopeRadians) -
getMaxSlope
public float getMaxSlope() -
setContactResponse
public void setContactResponse(boolean newState) Enable/disable this body's contact response.- Parameters:
newState
- true to respond to contacts (default=true)
-
isContactResponse
public boolean isContactResponse()Test whether this body responds to contacts.- Returns:
- true if responsive, otherwise false
-
onGround
public boolean onGround() -
jump
public void jump() -
setCollisionShape
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 classPhysicsCollisionObject
- Parameters:
collisionShape
- the CollisionShape to set
-
setPhysicsLocation
Set the physics location (same as warp())- Parameters:
location
- the location of the actual physics object
-
getPhysicsLocation
- Parameters:
trans
- storage for the result (modified if not null)- Returns:
- the physicsLocation
-
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 com.bulletphysics.dynamics.character.KinematicCharacterController getControllerId()used internally- Returns:
- the pre-existing object
-
getObjectId
public com.bulletphysics.collision.dispatch.PairCachingGhostObject getObjectId()used internally- Returns:
- the pre-existing object
-
destroy
public void destroy() -
write
- Specified by:
write
in interfaceSavable
- Overrides:
write
in classPhysicsCollisionObject
- Throws:
IOException
-
read
- Specified by:
read
in interfaceSavable
- Overrides:
read
in classPhysicsCollisionObject
- Throws:
IOException
-