79227886

Date: 2024-11-26 18:37:10
Score: 0.5
Natty:
Report link

If I correctly understood your question, you have a tank which is composed of a body, which moves with WASD, and a turret linked with the camera which move with mouse movement. Since you haven't posted code, I suppose you wanna hear the concept more than the code.

The problem is how you structured your tree. You said:

I have a tank on the scene with a turret attached as a child object

Since the turret is a child of the tank, EVERY rotation, POSITION, scale update on father are applied to childs (for Godot's logic). So this is a problem, because if you rotate the tank, even the turret will rotate even if you haven't moved the mouse.

In order to fix this, you should have a tree where the father is a generic Node with two childs (two nodes), one for the turret and the camera and one for the body, both with their own script to change with user input.

This should fix this

I implemented something similar, but when the tank rotates, the turret rotates with it,

To do something "smoothly rotate" I suppose you want a system where camera rotates and after a "delay" turret rotates too. You can do so using lerp. I link to the official documentation for more

As isherwood mentioned, your question is incomplete. Please, provide more informations (and some code) if you need more assistance/what I said is not what you are searching for.

Greetings

Reasons:
  • Long answer (-1):
  • No code block (0.5):
  • Low reputation (1):
Posted by: Roci49