the top looks like this (with comments). three dots (...) means there is other code inbetween
class_name CharacterController3D
## Main class of the addon, contains abilities array for character movements.
## Emitted when the character controller performs a step, called at the end of
## the [b]move()[/b]
## function when a move accumulator for a step has ended.
signal stepped
...
var _direction_base_node : Node3D
...
func setup():
_direction_base_node = self
_abilities = _load_nodes(abilities_path)
_default_height = collision.shape.height
_connect_signals()
_start_variables()
## Moves the character controller.
## parameters are inputs that are sent to be handled by all abilities.
func move(_delta: float, input_axis := Vector2.ZERO, input_jump := false, input_crouch := false, input_sprint := false, input_swim_down := false, input_swim_up := false) -> void:
var direction = _direction_input(input_axis, input_swim_down, input_swim_up, _direction_base_node)
if not swim_ability.is_floating():
_check_landed()
if not jump_ability.is_actived() and not is_fly_mode() and not is_submerged() and not is_floating():
velocity.y -= gravity * _delta
...
func _direction_input(input : Vector2, input_down : bool, input_up : bool, aim_node : Node3D) -> Vector3:
_direction = Vector3()
*var aim = aim_node.get_global_transform().basis*
if input.x >= 0.5:
_direction -= aim.z
if input.x <= -0.5:
_direction += aim.z
if input.y <= -0.5:
_direction -= aim.x
if input.y >= 0.5:
_direction += aim.x
# NOTE: For free-flying and swimming movements
if is_fly_mode() or is_floating():
if input_up:
_direction.y += 1.0
elif input_down:
_direction.y -= 1.0
else:
_direction.y = 0
return _direction.normalized()
it is called within the move function but only fails when aim_node.get_global_transform().basis is called