- Edited
CryptoMares CharacterBody
is KINEMATIC, it is not moved by physics, it is moved by code.
if you want the player to react to physics you need to use a rigidbody.
if you want to measure the speed of a CharacterBody
, the best way is to store the global_position
in a variable and compare it with the global_position
:
var last_pos : Vector3
var curr_speed : float = 0.0
func _ready():
last_pos = global_position
func _physics_process(delta):
curr_speed = last_pos.distance_to(global_position)
last_pos = global_position
I believe you can divide curr_speed
by delta
to get the speed per second:
curr_speed = last_pos.distance_to(global_position) / delta