I have a problem with ammo in my game. I've already programmed to shoot bullets right in front of my character and forward, but when I turn the camera, the bullets kind of change direction. Here's the bullet code:
`extends CharacterBody3D
const SPEED = 20.0
var DIRECCION = self.basis.z
func _process(delta: float) -> void:
position += DIRECCION * SPEED * delta`
And here's what I got in player's code:
`var Bullet = preload("res://scenes/bullet.tscn")
@onready var pivote = $visuals/Player/Gun/Spatial
func _input(event):
if event.is_action_pressed("shoot"):
var bullet = Bullet.instantiate()
add_child(bullet)
bullet.global_transform = pivote.global_transform`
This happens when turning the camera counterclockwise:
Let me know if you want to know more of my code.