0 votes

How would I get the 3d position and use it to change a variable?

get_node("/root/Spatial/sfvm390wg").get_translation(by,bx,bz))
by = posdy
bx =posdx
bz = posdz
in Engine by (40 points)

So are you trying to store the position or change the translation with variables? Because it looks like you’re trying to change the variables you just set.

I'm trying to get the position of object every frame and use it to store variables of position
that are changing.

1 Answer

0 votes

The first thing that jumps out at me is that you set the variables by, bx, and bz and then change them into something else. Try out:

       get_node("/root/Spatial/sfvm390wg").get_translation(by,bx,bz))
var posdy = by
var posdx = bx
var posdz = bz

that makes more sense to me. I deal mainly with 2D and I'm not sure what the context of your code is so I hope that helps.

by (93 points)
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 Frequently asked questions and 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 [email protected] with your username.