What is the Godot equivalent to object.transform.position?

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

I asked another question yesterday, but it was more elaborate, and no one has answered it so I decided to take a step back and ask a more general question. So, object being a node (in Godot) or a GameObject (in Unity) what is the Godot equivalent to this?

What are you trying to do?
I am trying to modify the transform y position.

What have you tried?
I have tried the following:

# The Most Current:
object.basis.y += variableName
# Another Thing I tried:
object.origin.y += variableName
# The last other thing I've tried:
object.translated(Vector3(0, variableName, 0))

Can anyone help me out?

:bust_in_silhouette: Reply From: PunchablePlushie

I’ve never worked in 3D so I can’t personally help you, but this answer by kidscancode on another question might help you.

From that answer:

3D nodes don’t have a position property. All 3D nodes inherit from Spatial. A Spatial node has a transform (and a global_transform).

Transforms contain the position, rotation, and scale information of the body in the form of a matrix. You can access the individual components by transform.origin - the coordinates in 3D space, and transform.basis - which contains the orientation.

More about transforms here:
Matrices and transforms — Godot Engine (3.3) documentation in English

You might also want to checkout this one:

thanks I’ll check it out.

jGames20 | 2021-05-12 22:58

I checked it out, thanks it led me to a sufficient answer. Turns out I was doing it wrong. You see I was doing:

object.basis.y += variableName

When I should’ve been doing this instead:

object.basis.y.y += variableName

Also, I’m going to look into vector math more. Thanks again!

jGames20 | 2021-05-13 03:39

Glad it was helpful!

PunchablePlushie | 2021-05-13 04:35