26 lines
595 B
GDScript
26 lines
595 B
GDScript
extends Path3D
|
|
|
|
var post: float = 0
|
|
@export var extend_rate: float = 0.01
|
|
@export var extend_max: float = 5.0
|
|
var extending: bool = true
|
|
var grapple: bool = true
|
|
|
|
##TODO Add logic to retract if path collides with a solid object
|
|
func _process(_delta: float) -> void:
|
|
|
|
##extend the grapple out to the max distance then return it
|
|
if grapple == true:
|
|
if post > extend_max:
|
|
extending = false
|
|
|
|
if extending == true:
|
|
post += extend_rate
|
|
else:
|
|
post -= extend_rate
|
|
|
|
if extending == false and post <= 0.1:
|
|
grapple = false
|
|
|
|
self.curve.set_point_position(1, Vector3(post,0,0))
|