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.)
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.
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.-