File size: 493 Bytes
8438369
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
extends Motion

@export var floor_ray_cast: RayCast3D

func _update(delta: float) -> void:
	set_direction()
	calculate_gravity(delta)
	calculate_velocity(speed,direction,PLAYER_MOVEMENT_STATS.in_air_acceleration,delta)
	
	if floor_ray_cast.is_colliding():
		if direction != Vector3.ZERO:
			animation_change_requested.emit("Run")
		else:
			animation_change_requested.emit("Idle")
	
	if is_on_floor():
		if direction != Vector3.ZERO:
			finished.emit("Run")
		else:
			finished.emit("Idle")