#i am new to godot but i need help with GD script (solved)

7 messages · Page 1 of 1 (latest)

cold matrix
#

how i can like tp or instantly move an object to a given coordinate i am sorry if i am being stupid

#

all the stuff i did dont work

shell pebble
#

what type of node is the object you want to move? Rigidbody, Characterbody, Node2d/3d?

cold matrix
#

is is a area2D node

shell pebble
#

Should be able to set its global_position to a coordinate.
position works too, but that can cause problems if it's parented to another object.

#

the coordinate will need to be represented by a Vector2.
Code wise, uh
area2dname.global_position = Vector2(x, y)
where area2dname is a reference to your area node, and x and y the coordinates.
If this function is in a script the area2D has attached to it, you can omit area2dname. and just set global_position directly.

cold matrix
#

thanks