27 lines
678 B
GDScript3
27 lines
678 B
GDScript3
|
extends Node
|
||
|
|
||
|
onready var player = $"/root".find_node("Player", true, false)
|
||
|
|
||
|
func vec3_componentwise_clamp(vec: Vector3, lower: float, upper: float) -> Vector3:
|
||
|
return Vector3(
|
||
|
clamp(vec.x, lower, upper),
|
||
|
clamp(vec.y, lower, upper),
|
||
|
clamp(vec.z, lower, upper)
|
||
|
)
|
||
|
|
||
|
func vec2_xz_to_vec3(xz: Vector2, y: float = 0.0) -> Vector3:
|
||
|
return Vector3(xz.x, y, xz.y)
|
||
|
|
||
|
func vec3_xz(vec: Vector3) -> Vector2:
|
||
|
return Vector2(vec.x, vec.z)
|
||
|
|
||
|
func deactivate_node(node: Node):
|
||
|
node.set_process(false)
|
||
|
node.set_physics_process(false)
|
||
|
node.set_process_input(false)
|
||
|
|
||
|
func activate_node(node: Node):
|
||
|
node.set_process(true)
|
||
|
node.set_physics_process(true)
|
||
|
node.set_process_input(true)
|