This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes
Godot version 4.0 dev build
in Engine by (67 points)

1 Answer

+1 vote
Best answer

You don't need to. Godot uses transform. If you have two nodes A and B and and you want to face A's forward direction to B then just do:

B.transform.basis.z = A.transform.basis.z

Remember In Godot, Z axis is forward, X axis is right and Y axis is up. More info here :

by (153 points)
edited by

for example I want to get the forward of velocity (Vector3) and apply it to the player

as I understand from what you said is that I have to only set the z axis of the player to the value of z axis in the velocity


Player.transform.basis.z = velocity.z

I'm sorry for late reply but yes, that should work.

And yes one more thing; there are also global transforms in Godot. So if by chance its not working maybe you need to swap between global to local or vise versa based on your scenario.

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.