Snap object's y rotation at 90° intervals when using .look_at()

Godot Version

4.7.stable

Question

Hello! I’m trying to snap the y rotation of an object to 90° intervals. However, this object is always looking at the player on the y axis (using .look_at)

Thanks!

Can you share the relevant script code?

You can set a snap to the rotation.y or rotation_degrees.y after using look_at to generate a rotation.

I think.

Because there is no code shared, you leave us guessing a little.

For instance, I now do not know whether you know about all the flavors of snappedf

do something like

rotation.y = snapped(rotation.y,90)

This is incorrect as rotation is in radians, not degrees, it would be snappedf(rotation.y, PI / 2.0) or snappedf(rotation_degrees.y, 90)