KX_CharacterWrapper
Base class: EXP_PyObjectPlus
A wrapper to expose character physics options.
onGround
Section titled “onGround”Whether or not the character is on the ground. (read-only)
Type: boolean
gravity
Section titled “gravity”The gravity value used for the character.
Type: float
fallSpeed
Section titled “fallSpeed”The character falling speed.
Type: float
maxJumps
Section titled “maxJumps”The maximum number of jumps a character can perform before having to touch the ground. By default this is set to 1. 2 allows for a double jump, etc.
Type: int in [0, 255], default 1
jumpCount
Section titled “jumpCount”The current jump count. This can be used to have different logic for a single jump versus a double jump. For example, a different animation for the second jump.
Type: int
jumpSpeed
Section titled “jumpSpeed”The character jumping speed.
Type: float
maxSlope
Section titled “maxSlope”The maximum slope which the character can climb.
Type: float
walkDirection
Section titled “walkDirection”The speed and direction the character is traveling in using world coordinates. This should be used instead of applyMovement() to properly move the character.
Type: Vector((x, y, z))
jump()
Section titled “jump()”The character jumps based on it’s jump speed.
jumpDirection
Section titled “jumpDirection”The direction the character is jumping.
Type: Vector((x, y, z))
setVelocity(velocity, time, local=False)
Section titled “setVelocity(velocity, time, local=False)”Sets the character’s linear velocity for a given period.
This method sets character’s velocity through it’s center of mass during a period.
velocity: Linear velocity vector.- type: 3D Vector
time: Period while applying linear velocity.- type: float
local: * False: you get the “global” velocity ie: relative to world orientation. * True: you get the “local” velocity ie: relative to object orientation.- type: boolean
smoothMovement
Section titled “smoothMovement”Smooth movement caused by walking direction.
Type: float (0.0 to 1.0)
reset()
Section titled “reset()”Resets the character velocity and walk direction.
