Gameplay Related Components

Cave Engine prodives some builtin Gameplay Related components for you to use out of the box in your games. You'll find their documentation here.

cave.PlayerControllerComponent

The PlayerControllerComponent is a builtin component that you can use to add player controls to a Character. It will allow the user to move your entity around with W, A, S, D , jump with Space and run with Left Shift.

(Note that the Player Component will only work if its Entity also have a CharacterComponent).

Variables
Variable Description
active The PlayerControllerComponent will only run if this is set to True (as it is by default). You can use this do temporarely disable the Player's movement.
walkSpeed Defines the Player's walk speed.
runSpeed Defines the Player's run speed.
localMovement If true, the Player will walk in local space, meaning that "forward" refers to the actual Entity's Transform's forward.
jump The Player will only jump if this is set to True.

Here is the Python API for Reference:

active        : bool
walkSpeed     : float
runSpeed      : float
localMovement : bool
jump          : bool
Methods
isWalking() -> bool
isRunning() -> bool

cave.MouselookComponent

If you want to make a Mouselook, you can use this builtin Cave Component to achieve that. That's useful for first and third person games, but not limited to it: This component works with any Entity (not only cameras), so feel free to use your creativity in order to get the best out of it.

Variables
Variable Description
lockMousePos If True, it will disable the mouse visibility and lock it to the center of the screen. When doing a mouselook, that's probably what you expect it to do.
xAxis Use this to adjust the mouse X axis (horizontal) behaviour.
yAxis Use this to adjust the mouse Y axis (vertical) behaviour.

Here is the Python API for Reference:

lockMousePos : bool
xAxis        : cave.MouselookAxisConfig
yAxis        : cave.MouselookAxisConfig

cave.MouselookAxisConfig

This is a class designed to provide configuration settings for the MouselookComponent. You'll only find it there.

Variables
Variable Description
use If True, the Mouselook will use this Axis.
rotationLocal If True, it will apply a local rotation in the Transform. Global, otherwise.
rotationAxis Can be 0, 1 or 2, representing the X, Y and Z axis, respectively.
sensitivity The Mouselook sentitivity in this Axis. Tip: if you want to invert the mouselook, you can set a negative sensitivity.
threshold The minimum mouse movement before it starts considering it.

Here is the Python API for Reference:

use : bool
rotationLocal : bool
rotationAxis  : int
sensitivity   : float
threshold     : float