13 lines
379 B
GDScript
13 lines
379 B
GDScript
extends Area3D
|
|
|
|
@export var velocity = Vector3.ZERO
|
|
|
|
# Called when the node enters the scene tree for the first time.
|
|
func _ready():
|
|
body_entered.connect(_on_area_entered)
|
|
|
|
func _on_area_entered(body : RigidBody3D) -> void:
|
|
if (get_parent_node_3d().quaternion * velocity).dot(body.linear_velocity) > 0.0 :
|
|
body.linear_velocity = get_parent_node_3d().quaternion * velocity
|
|
|