I am trying to make a the mask(the visual representation of an enemy, in this case the mask is a 3D model in 3D space) always look at the player, but only on the y-axis(I don't want it to face the player, only to look). I have some code that doesn't function correctly. It produces a result but the result does not match what I want.
func _process(delta):
pPos = player.translation
mPos = mask.translation
angle = mPos.angle_to(pPos)
mask.rotation.y = angle
All of the lines in the code above work. They just constantly produce the same of result of roughly 2.7 and the model is rotated 2.7 radians. The problem isn't the radians, its the fact that nothing changes. What can I do to fix this code?