working on rat

This commit is contained in:
derek
2025-05-12 16:43:25 -05:00
parent 4c98bca83b
commit ed3c47e9cf
10 changed files with 119 additions and 92 deletions

View File

@@ -1,26 +1,15 @@
extends Node3D
class_name RatHole
@export var rat : Resource
@onready var ray = $RayCast3D
@onready var spawnpos: Marker3D = $spawnpos
@onready var area_3d = $Area3D
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
pass
func spawn_rat(end_hole,control_node):
func spawn_rat(end_hole):
var spawn_rat = rat.instantiate()
spawn_rat.position = ray.global_position
spawn_rat.transform.basis = ray.global_transform.basis
spawn_rat.look_at_from_position(end_hole.position,Vector3.UP)
spawn_rat.position = spawnpos.global_position
spawn_rat.end_hole = end_hole
get_tree().get_root().add_child(spawn_rat)
get_parent().add_child(spawn_rat)
func _on_area_3d_body_entered(body):
if body.is_in_group("rat"):