0 votes

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?

Godot version 3.3.stable.official
in Engine by (23 points)

1 Answer

+1 vote
Best answer

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:

You might also want to checkout this one:

by (172 points)
selected by

thanks I'll check it out.

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!

Glad it was helpful!

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.