Trouble with emulating a mouse-based shooting mechanic in 3D top-down space

Currently, when I press the input key (clicking) to spawn the instance of the bullet, it shoots out in one static direction no matter where the mouse is, its spawn point being the middle of the player. The bullet spawned where it was supposed to. Yes, it moved where it was supposed to, but in the wrong direction (it did not shoot out in the mouse’s direction when pressing the input.)

I hope I’m understanding correctly.

Yes. That’s where its position adds from.

Not sure why you have problem with this. It’s simple. Assign player’s global position to instance global position, then let the instance look at the mouse global position. That should be it.

If you want to move it in the direction its facing move it along its global_basis.z vector.

The issue might be in the code that moves the bullet. Can you post the bullet script? Just the part that handles the bullet’s movement.

class_name Bullet extends Node3D

var player = PlayerCamera
var camera = PlayerCamera.camera

func _process(delta) -> void:

	global_position +=  Vector3(0,0,-PlayerAttributes.bullet_speed) * delta

That doesn’t move the bullet in its facing direction. You need to move it along its basis z vector after you’ve oriented it.

You have to move the bullet in the direction of its negative Z axis (Godot’s “forward” direction is -Z). So you have multiply the bullet’s negative Z axis (-global_basis.z), not the world’s negative z axis, wih the speed times delta, like this:

class_name Bullet extends Node3D

var player = PlayerCamera
var camera = PlayerCamera.camera

func _process(delta) -> void:

	global_position +=  -global_basis.z * (PlayerAttributes.bullet_speed * delta)

The way you were doing it before, you were just moving the bullent in the global -Z direction. It’s like, instead of saying “move to your forward direction”, you were telling it to move “north”.

I had a feeling it was this. I’m so sorry for the trouble. Most of my confusion dominantly came from not being very good with transformations and therefore being unsure how to re-write that line. Again very sorry, but this worked at last. Thank you guys.-

No need to apologize, this is what the Forum is for.
Keep working on your games and you’ll get the hang of it very soon.