In Tnua 0.30, character controls have moved from the TnuaPlatformerControls component to the TnuaController component. Controls should be passed every frame, preferably within the TnuaUserControlsSystemSet system set.
Base Movement
Instead of modifying TnuaPlatformerControls::desired_velocity, you must now pass a basis (such as TnuaBuiltinWalk) to the TnuaController. Note that TnuaBuiltinWalk::desired_velocity now represents both speed and direction, and float_height must be explicitly provided.
Jumping
Use the TnuaBuiltinJump action via the controller. The jump height is controlled by TnuaBuiltinJump::height. The jump is active as long as the action is being fed; once you stop passing the action, the jump stops automatically (no manual nullification required).
Crouching
Use the TnuaBuiltinCrouch action via the controller. Set the float_offset within the action. For enforcing crouching behavior under obstacles, use TnuaCrouchEnforcer instead of the deprecated TnuaKeepCrouchingBelowObstacles.
// Base movement
controller.basis(TnuaBuiltinWalk {
desired_velocity: the_desired_velocity,
float_height: 2.0, // must be passed
..Default::default()
});
// Jumping
if should_jump {
controller.action(TnuaBuiltinJump {
height: 4.0,
..Default::default()
});
}
// Crouching
if should_crouch {
controller.action(TnuaBuiltinCrouch {
float_offset: -0.9,
..Default::default()
});
}