Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Noddy |
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?
What your scene tree looks like? And where the player
and the mask
nodes are located on the tree?
Dlean Jeans | 2019-06-20 06:41
Noddy | 2019-06-21 00:44
The image is not showing. You can instead call print_tree_pretty() and post it here. Remember to format it as a code block with the {}
button.
Dlean Jeans | 2019-06-21 06:32
Picture of the scene tree (saw the link in my email):
Dlean Jeans | 2019-06-21 12:10