22 lines
614 B
GDScript
22 lines
614 B
GDScript
extends Node3D
|
|
|
|
@export var damage : float = 1
|
|
@export var pushback : float = 5
|
|
@onready var outline_meshes = [$Spikes1/MeshInstance3D]
|
|
|
|
@onready var ray_cast: RayCast3D = $RayCast3D
|
|
|
|
# Called when the node enters the scene tree for the first time.
|
|
func _ready() -> void:
|
|
pass # Replace with function body.
|
|
|
|
|
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
func _process(delta: float) -> void:
|
|
pass
|
|
|
|
func _on_area_3d_body_entered(body: Node3D) -> void:
|
|
if body.is_in_group("player"):
|
|
body.hit(damage,self)
|
|
body.velocity = ray_cast.global_transform.basis * Vector3(0,0,-pushback)
|