Godot Version
v4.2.stable.official [46dc27791]
Question
I have a 3D tank, made up of a parent “chassis” and a child “turret”.
The turret rotation is locked onto the Y axis. And when the turret is placed independently, it works as desired, only rotating on said Y axis and pointing towards the mouse cursor.
However, when the turret is placed as a child of a chassis, the turret will rotate on all axis, with the entire turret rotating up and down, clipping through the vehicle body, and behaving in a way that is less than desirable.
I’ve attached a video to illustrate the issue below.
The script driving the turret rotation is relatively simple.
turret.look_at(Vector3(MainDataBus.mouse_position.x, position.y, MainDataBus.mouse_position.z), Vector3(0,1,0))
What I would like is for the turret to rotate only on the Y Axis, in referenced to the orientation of the parent tank chassis, similar to how a turret attached to a tank chassis would behave in real life. But I do not understand why the turret seems to lose that constraint when it becomes a child to another node. I have experimented with Axis lock, but they seem to be overridden by what I believe is the Look_at function, and have yielded no results when attempt to use them.
Thank you for taking the time to read my topic.