Bullet won't move

Godot Version

4.5.1 Stable

Question

Hey, it’s me again, the person who can’t make an enemy….

So, I decided to rethink my the enemy itself deciding it was a bit too over complicated. So I made a new enemy and they can now look at the player fine. Problem is, the bullets spawn in but don’t move. They are clearly spawning in, but they just stay there, and create a circle around the enemy if I walk around the enemy. I’m very confused by this.

I have presented the code and node tree below:

Enemy Code:

extends Node3D

#@export var player: CharacterBody3D = Autoload.player
@onready var raycast = $RayCast3D
@onready var eneMesh = $MeshInstance3D

var shoot = false
var health = 100
var time := 0.0
var target_position: Vector3
var killed = false
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
	target_position = position


# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
	self.look_at(Autoload.player.global_position + Vector3(0, 0.5, 0), Vector3.UP, true)

Bullet Code:

extends RayCast3D

@export var Speed := 50.0
var debug = 0
@onready var timer = $Timer
func _physics_process(delta: float) -> void:
	#print("Fire")
	timer.start(0.1)
	if timer.is_stopped():
		position += global_basis * Vector3.FORWARD * Speed * delta
		#target_position = Vector3.FORWARD * Speed * delta
		target_position = Vector3.FORWARD * Speed * delta
	
	force_raycast_update()
	var collider = get_collider()
	if is_colliding():
		if collider != $".":
			global_position = get_collision_point()
			set_physics_process(false)
func cleanup():
	queue_free()


func _on_timer_2_timeout() -> void:
	print(position)

Launcher code:

extends Node3D

const bullet = preload("res://bullet.tscn")
@onready var soldier = $".."
# 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:
	if soldier in get_tree().get_nodes_in_group("canShoot"):
		var fire = bullet.instantiate()
		add_child(fire)
		fire.global_transform = global_transform

Node Tree:

Help would be very appreciated, thank you.

What’s the purpose of the timer in the bullet scene?

Currently, the bullet will only change its position when the timer is stopped. But right before that the timer is started (or reset if it was already running), so the timer will never be stopped.

It’s meant to reduce how many times the bullet fires, thus reducing lag.

I didn’t think of this though, thank you

But however, now my bullets go down to the ground? Which is really weird