meat_madness_redux/godot/player/CloseToFloor.gd

18 lines
377 B
GDScript

extends RayCast
var is_on_floor = false
var floor_distance = 0.0
export var min_floor_distance = 0.5
func _process(_delta):
force_raycast_update();
if is_colliding():
var point = get_collision_point();
floor_distance = to_local(point).length();
if floor_distance < min_floor_distance:
is_on_floor = true
else:
is_on_floor = false
else:
is_on_floor = false