- Edited
I feel stupid asking this, since I don't think it's supposed to be this hard, but it's frustrating me.
Basically, I have my enemy shooting something at the player, but using Basis.looking_at is making it fire in all kinds of weird directions.
This code is attached to the 'Enemy' node
var rockroll = rockroll_scene.instantiate()
owner.add_child(rockroll)
rockroll.global_transform = global_transform
rockroll.position.y = 0
rockroll.global_basis = Basis.looking_at(targets[0].global_position, Vector3.UP)
I've tried a number of variations on this code, but they all do about the same thing. The only time it's consistently faced the player is when I don't change rockroll's global_transform and it spawns at (0, 0, 0).
What am I doing wrong?