Keyword "translation" doesn't work in Godot 4 because it's seen as a variable, what should I use instead?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By cynetri

In Godot 3, I made a small, 3rd-person car game to practice using Godot, and I used a Spring Arm with a script I wrote with the help of a tutorial. However, that tutorial told me to use the translation keyword to assign the Spring Arm’s translation to the car, and then specifically to set the y translation.

The code

When I copied the script over to Godot 4, I had a few errors which I expected and removed, however I can’t figure out how to fix this one. It treats “translation” as if it’s a variable name, however Godot 3 treats it as the car’s position, which I want.

I would just leave the Spring Arm parented to the car, but it also rotates with the car and I don’t want that.

:bust_in_silhouette: Reply From: kidscancode

translation was renamed to position in Godot 4 for consistency between 2D and 3D.

Thank you so much for this I was pulling my hair out and I couldn’t find it in the documentation anywhere.

elbow6677 | 2022-11-06 16:24

FYI, it’s documented here:
Node3D — Godot Engine (latest) documentation in English

kidscancode | 2022-11-06 17:02

1 Like