![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | lucasfazzi |
Well, I’m doing a 3D FPS and this is my first 3D project; I have a good knowledge of Godot 2D, but thinking about 3D has still been an obstacle.
In this case, I want to make an enemy bullet that takes the player’s starting position as a reference to follow a straight line, but without following the player after that. Kind of like the Imp bullet in the classic Doom.
In this case, I was doing something like this, taking the bullet from the Godot tutorial and modifying it, but it turns out that, obviously, in this mechanism the direction of the bullet remains the Z of the player, so that if the player moves, the enemy’s bullet chases him by Z position.
that said, what would be the best solution for this not to happen? i’m stuck and i can’t illuminate at all.
extends Area
onready var player = get_parent().get_node("Player")
var speed = 2
func _physics_process(delta):
var forward_dir = player.global_transform.basis.z.normalized()
global_translate(forward_dir * speed * delta)