CharacterBody3D not using +Z for look_at

Godot Version



I am trying to have a CharacterBody3D point in the direction that it is going. I have code that I used for the Udemy course currently implemented with the same conditions, however, my CharacterBody always seems to be using the +X as its forward direction. Rotating the body in the editor doesn’t seem to work and I have use_model_front set to true in my look_at function. Any help would be greatly appreciated! Here are some screenshots for reference.

The code for look_at is identical to the course minus the need for gravity as I only x and z movement.
look_at_target() and physics process function

The “front” of my ship is pointing correctly within the editor for it to be oriented with +Z as the front.

CharacterBody3D orientation in 3D Space

Thanks in advance for any advice!

direction_to() returns a normalized vector. So just adding global_position + direction might not do the trick. Why not just use the next_path_position?

There was a change when using next_path_position but it still wasn’t oriented correctly. The orientation seemed to change randomly each time a new target was chosen.

Bypassing the direction_to() here is the current state and an image of how the movement is going. Seems to still be set on using the +X as its front.
movment direction
bypassing direction_to()

I did copy your code into a new project (instead of the navigation_agent I used a dummy MeshInstance3D as the target) and it worked fine on my end.
So the only thing I can think of is that the rotation of the ship model is somehow wrong. This might have to do with where the ship is placed in the scene tree. Can you post a screenshot of it with child nodes?