I’ve been working on a problem for 1 week, trying to find the angle needed to look towards a node, which I then apply to an animation key I’m playing. But it’s absolutely not working correctly, at first I thought I was doing the global to local conversion wrong, but after testing all the possibilities I could find via help, ia, and forums like reddit and godot, it still wasn’t working. What’s more, the camera’s x-axis rotation seemed to apply to the z-axis. Then I realized that rotation only works in a single case, if my player has rotated 90 degrees to the left from its original rotation point. I’m lost and I don’t understand. I’ll show you my code, a visual overview(Low quality otherwise impossible to upload), and the locations of the nodes I’m trying to rotate.
Is there anything else affecting the camera’s rotation? I notice it rolls (z-axis rotation) the first time in the video which shouldn’t happen given the tween code. I also notice your original sample was using the basis inverse which is strange on a already global coordinate vector.
With “tween”, the camera no longer turns on the z axis, but still doesn’t point exactly at the mob. And as for the “basis.invers()”, it’s because that’s what allowed me to get something as close as possible to what I wanted, otherwise it was worse. And I put it in to try out a bit of everything to see what I could come up with.
I’ve discovered something new, I’ve added a mesh that is placed on the calculated direction, the direction is good. The problem doesn’t come from there, so I came up with the idea of displaying the value of the target angle variable, then once the animation is complete, the player’s rotation, guess what! They’re different. The code is supposed to apply the value of the variable!
I’m discovering more and more strange things, when I display the value of the key previously modified, at the end of the animation and at the beginning, it displays the value of the target angle. The animation doesn’t seem to want to play this animation, and takes a value that seems random.