+1 vote

I am trying to figure out how to get the target andgle and current angle of my character relative to the player. target angle is the angle that points to the player, current angle is the current angle to origin. this is my code so far:

angle = int(round(rad2deg(get_transform().basis.x.angle_to(Vector3(1,0,0)))))
target_angle = int(round(rad2deg(get_transform().basis.x.angle_to(player.get_translation()))))
print("curent rot", angle)
print("targ rot", target_angle)

I am not sure if I'm doing this correctly, but i want to use this angle and rotate on the y until it is aligned with the target rotation. it seems my curret rotation ad target rotations are incorrect however. :(

in Engine by (23 points)

Get_node("."). transform.basis().y * vector3(0,1,0)

THANK YOU!! I'll try This!! :)

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.