get_position

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

Hello! Every time a use the get_position method, appears the message(‘get_position’ is not declared in the current class) i think if i lost something.
Ps:I’m using a kinematic body.

:bust_in_silhouette: Reply From: kidscancode

KinematicBody derives from Spatial. position is a property of Node2D - there is no position property on 3D nodes.

If you want to get the coordinates of a 3D object, use transform.origin. See Transform docs for details.

You don’t need to use the get_* method, btw, you can access node properties directly.

Thanks! Worked now.

olFrancis | 2019-07-26 05:23

:bust_in_silhouette: Reply From: Zylann

Actually there is a position property on Spatial nodes, it just has a different name: translation. It’s a shortcut for transform.origin.