Data Access
The main methods, start
, update
and done
have all access to the data
class. This holds a subset of OmniSteps parameters that you can use to access inputs, player and scene data.
Inputs
Inputs are monitored for four Action
keys / buttons, defined in the add-on preferences.
They are of the class InputState
:
Additionally you have access to other inputs, but these are booleans and vectors. Here the complete list of available inputs:
data.input.action1 # InputState
data.input.action2 # InputState
data.input.action3 # InputState
data.input.action4 # InputState
data.input.forward # bool
data.input.back # bool
data.input.left # bool
data.input.right # bool
data.input.up # bool
data.input.down # bool
data.input.restart # bool
data.input.respawn # bool
data.input.pad_move # Vector (Gamepad/Controller left stick)
data.input.pad_look # Vector (Gamepad/Controller right stick)
data.input.mouse_move # Vector (respects Input Smoothing)
data.input.mouse_pos_raw # Vector
Player State
There are several variables that reflect the current player state. The diagram below shows the most important values. The difference between view
and aim
is that view
includes motion damping and camera banking effects, while aim
does not.
data.player.view_pos # Vector data.player.view_vec # Vector data.player.view_mat # Matrix (view directon is -Z) data.player.aim_pos # Vector data.player.aim_vec # Vector data.player.aim_mat # Matrix (view directon is -Z) data.player.root_pos # Vector data.player.root_mat # Matrix data.player.fov # float
- For each parameter, there is a
Matrix
supplied alongside the position and Vectors. Be aware that the Matrix has the view / aim in the-Z
direction (due to Blender having a right-handed coordinate system). - The current player velocity (m/s).
- The current player acceleration (m/sĀ²)
- Is
True
when the player is considered in contact with the ground. - Is
True
when the player is touching a wall on any side. This is used for the 'Wall Jump' feature. - Is
True
when a teleport is in progress.
Scene State
- Timestep in seconds of the current viewport frame rate. (e.g. 0.01666.. at 60 fps)
True
if the the OmniStep animation section is active.- As the viewport frame rate and the Blender playback frame rate differ, this variable is true when they overlap. So at 60 fps viewport and 30 fps Blender playback rate, approx. every other frame this is
True
.
Use this to determine if a keyframe for a custom animation needs to be set. - Current scene frame.
- Timestep in seconds of the current Blender frame rate. This is simply
1.0 / data.scene.framerate
- Blender frame rate set in the Output panel. Same as
RenderSettings.fps
.