Package com.jme3.bullet.objects.infos
Class CharacterController
java.lang.Object
com.jme3.bullet.NativePhysicsObject
com.jme3.bullet.objects.infos.CharacterController
- All Implemented Interfaces:
Comparable<NativePhysicsObject>
The "action" (controller) portion of a PhysicsCharacter, based on Bullet's
btKinematicCharacterController.
-
Field Summary
Fields inherited from class com.jme3.bullet.NativePhysicsObject
loggerN
-
Constructor Summary
ConstructorDescriptionCharacterController
(PhysicsCharacter character) Instantiate a controller for the specified collision object. -
Method Summary
Modifier and TypeMethodDescriptionvoid
copyAll
(CharacterController source) Copy all parameter values from the specified controller.float
Determine the character's angular damping.getAngularVelocity
(Vector3f storeResult) Determine the character's angular velocity.float
Determine the character's maximum fall speed (terminal velocity).getGravity
(Vector3f storeResult) Determine the character's gravitational acceleration.float
Determine the character's jump speed.float
Determine the character's linear damping.getLinearVelocity
(Vector3f storeResult) Determine the linear velocity of the character's center.float
Determine the character's maximum penetration depth.float
Determine the character's maximum slope angle.float
Determine the character's step height.getUpDirection
(Vector3f storeResult) Determine the character's "up" direction.getWalkDirection
(Vector3f storeResult) Determine the character's walk offset.boolean
Test whether the ghost's convex-sweep test is in use.void
Jump in the specified direction.boolean
onGround()
Test whether the character is on the ground.void
reset
(PhysicsSpace space) Reset this controller, including its velocity.void
setAngularDamping
(float damping) Alter the character's angular damping.void
setAngularVelocity
(Vector3f angularVelocity) Alter the character's angular velocity.void
setFallSpeed
(float fallSpeed) Alter the character's maximum fall speed (terminal velocity).void
setGravity
(Vector3f gravity) Alter the character's gravitational acceleration.void
setJumpSpeed
(float jumpSpeed) Alter the character's jump speed.void
setLinearDamping
(float damping) Alter the character's linear damping.void
setLinearVelocity
(Vector3f velocity) Alter the linear velocity of the character's center.void
setMaxPenetrationDepth
(float depth) Alter the character's maximum penetration depth.void
setMaxSlope
(float slopeRadians) Alter the character's maximum slope angle.void
setStepHeight
(float height) Alter the character's step height.void
setSweepTest
(boolean useGhostSweepTest) Alter which convex-sweep test is used.void
Alter the character's "up" direction.void
setWalkDirection
(Vector3f offset) Alter the character's walk offset.void
Directly alter the location of the character's center.void
Directly alter the location of the character's center.Methods inherited from class com.jme3.bullet.NativePhysicsObject
compareTo, countTrackers, dumpTrackers, equals, freeUnusedObjects, hasAssignedNativeObject, hashCode, nativeId, reassignNativeId, setNativeId, setNativeIdNotTracked, toString, unassignNativeObject
-
Field Details
-
logger
message logger for this class
-
-
Constructor Details
-
CharacterController
Instantiate a controller for the specified collision object.- Parameters:
character
- the collision object to control (not null)
-
-
Method Details
-
copyAll
Copy all parameter values from the specified controller.- Parameters:
source
- the controller to copy from (not null, unaffected)
-
getAngularDamping
public float getAngularDamping()Determine the character's angular damping.- Returns:
- the viscous damping ratio (0→no damping, 1→critically damped)
-
getAngularVelocity
Determine the character's angular velocity.- Parameters:
storeResult
- storage for the result (modified if not null)- Returns:
- the velocity vector (either storeResult or a new vector, not null)
-
getFallSpeed
public float getFallSpeed()Determine the character's maximum fall speed (terminal velocity).- Returns:
- the speed (in physics-space units per second)
-
getGravity
Determine the character's gravitational acceleration.- Parameters:
storeResult
- storage for the result (modified if not null)- Returns:
- an acceleration vector (in physics-space units per second squared, direction opposite the "up" vector, either storeResult or a new vector, not null)
-
getJumpSpeed
public float getJumpSpeed()Determine the character's jump speed.- Returns:
- the speed (in physics-space units per second)
-
getLinearDamping
public float getLinearDamping()Determine the character's linear damping.- Returns:
- the viscous damping ratio (0→no damping, 1→critically damped)
-
getLinearVelocity
Determine the linear velocity of the character's center.- Parameters:
storeResult
- storage for the result (modified if not null)- Returns:
- a vector (either storeResult or a new vector, not null)
-
getMaxPenetrationDepth
public float getMaxPenetrationDepth()Determine the character's maximum penetration depth.- Returns:
- the depth (in physics-space units)
-
getMaxSlope
public float getMaxSlope()Determine the character's maximum slope angle.- Returns:
- the angle relative to the horizontal (in radians)
-
getStepHeight
public float getStepHeight()Determine the character's step height.- Returns:
- the maximum amount of vertical movement without jumping or falling (in physics-space units)
-
getUpDirection
Determine the character's "up" direction.- Parameters:
storeResult
- storage for the result (modified if not null)- Returns:
- a unit vector (in physics-space coordinates, in the direction opposite the gravity vector, either storeResult or a new vector, not null)
-
getWalkDirection
Determine the character's walk offset.- Parameters:
storeResult
- storage for the result (modified if not null)- Returns:
- an offset vector (either storeResult or a new vector, not null)
-
isUsingGhostSweepTest
public boolean isUsingGhostSweepTest()Test whether the ghost's convex-sweep test is in use.- Returns:
- true if using the ghost's convex-sweep test, otherwise false
-
jump
Jump in the specified direction.- Parameters:
direction
- desired jump direction (not null, unaffected) or (0,0,0) to jump in the "up" direction
-
onGround
public boolean onGround()Test whether the character is on the ground.- Returns:
- true if on the ground, otherwise false
-
reset
Reset this controller, including its velocity.- Parameters:
space
- (not null)
-
setAngularDamping
public void setAngularDamping(float damping) Alter the character's angular damping.- Parameters:
damping
- the desired viscous damping ratio (0→no damping, 1→critically damped, default=0)
-
setAngularVelocity
Alter the character's angular velocity.- Parameters:
angularVelocity
- the desired angular velocity vector (not null, unaffected)
-
setFallSpeed
public void setFallSpeed(float fallSpeed) Alter the character's maximum fall speed (terminal velocity).- Parameters:
fallSpeed
- the desired speed (in physics-space units per second, default=55)
-
setGravity
Alter the character's gravitational acceleration. This may also alter its "up" vector.- Parameters:
gravity
- the desired acceleration vector (in physics-space units per second squared, not null, finite, unaffected, default=(0,-29.4,0))
-
setJumpSpeed
public void setJumpSpeed(float jumpSpeed) Alter the character's jump speed.- Parameters:
jumpSpeed
- the desired speed (in physics-space units per second, default=10)
-
setLinearDamping
public void setLinearDamping(float damping) Alter the character's linear damping.- Parameters:
damping
- the desired viscous damping ratio (0→no damping, 1→critically damped, default=0)
-
setLinearVelocity
Alter the linear velocity of the character's center.- Parameters:
velocity
- the desired velocity vector (not null, finite)
-
setMaxPenetrationDepth
public void setMaxPenetrationDepth(float depth) Alter the character's maximum penetration depth.- Parameters:
depth
- the desired depth (in physics-space units, default=0.2)
-
setMaxSlope
public void setMaxSlope(float slopeRadians) Alter the character's maximum slope angle.- Parameters:
slopeRadians
- the desired angle relative to the horizontal (in radians, default=Pi/4)
-
setStepHeight
public void setStepHeight(float height) Alter the character's step height.- Parameters:
height
- the desired maximum amount of vertical movement without jumping or falling (in physics-space units, default=1)
-
setSweepTest
public void setSweepTest(boolean useGhostSweepTest) Alter which convex-sweep test is used.- Parameters:
useGhostSweepTest
- true to use the ghost's test, false to use the world's test (default=true)
-
setUp
Alter the character's "up" direction. This may also alter its gravity vector.- Parameters:
direction
- the desired direction (not null, not zero, unaffected, default=(0,1,0))
-
setWalkDirection
Alter the character's walk offset. The offset must be perpendicular to the "up" direction. It will continue to be applied until altered again.- Parameters:
offset
- the desired location increment for each simulation step (in physics-space coordinates, not null, finite, unaffected, default=(0,0,0))
-
warp
Directly alter the location of the character's center.- Parameters:
location
- the desired physics location (not null, finite, unaffected)
-
warpDp
Directly alter the location of the character's center.- Parameters:
location
- the desired physics location (not null, finite, unaffected)
-