- Edited
I've started wanting to code again due to godot 4 being released but I'm still new as well as being dependent on coding tutorials and my raycast wont detect other groups and wont print anything out here's my code and I apologize in advance if the code is horrible.
extends Node
var fire_rate = 0.5
var clip_size = 20
var reload_time = 1
var current_ammo = clip_size
var can_shoot = true
var reloading = false
@onready var raycast := $neck/camera3D/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
if Input.is_action_just_pressed("primary shoot") and can_shoot:
if current_ammo >0 and not reloading:
print("shot")
func check_collision():
if raycast.is_colliding():
var collider = raycast.get_collider()
if collider.is_in_group('badman'):
print('badmandead')