How to get rigidbody objects position through script?

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

I already got help to get the object access through other code, Thanks to @jgodfrey. I need to get the balls’ position, but there is a error saying Invalid get index 'position'(on base:'Rigidbody").

here is the code I tried

extends Camera

onready var ball = get_node("../Ball")

func _process(delta):
   look_at(ball.position, Vector3.UP)

file download: https://drive.google.com/file/d/1t4a9rwBUqO3jsgYfLfvKkuMRp4Yc7B-r/view?usp=sharing

i guess the game 3D

func _process(delta):
  //look_at(ball.position, Vector3.UP)
    look_at(ball.global_transform, Vector3.UP))   

ramazan | 2022-07-16 07:49

:bust_in_silhouette: Reply From: USBashka

3D objects haven’t property position. Instead, they are have property translation, which is Vector3.

You can see parameters’ names in the inspector tab (by hovering them with mouse).