2 Pluspunkte 0 Minuspunkte

Wie finde ich die Länge eines Raycast heraus?

extends RayCast3D

func _process(delta):
    if is_colliding():
        var length = # Länge des Ray???
        print("colliding with ", get_collider(), " at a distance of ", length)
    else:
        print("not colliding")
bezieht sich auf eine Antwort auf: Godot 3d Raycast
von  

1 Antwort

0 Pluspunkte 0 Minuspunkte

Indem du die Position des Collider von der Position des Raycast3D subtrahierst.

var length = (global_position - get_collider().global_position).length()
von (716 Punkte)