Beginner question - how to get coordinates of a physics object?

display.setStatusBar( display.HiddenStatusBar )  
require('physics')  
physics.start()  
physics.setGravity(0,0)  
  
local pilka = display.newCircle(240,450,15)  
physics.addBody(pilka,'dynamic',{density=1,bounce=1})  
pilka:setLinearVelocity(math.random(-50,50),math.random(-400,400))  
  
local test = display.newText(pilka.y,200,20,native.systemFont,48)  

As the circle moves, the position of its centre changes. How can I get it? The value of pilka.y doesn’t change. [import]uid: 227611 topic_id: 36057 reply_id: 336057[/import]

The position of any display object is always it’s .x and .y values. So, for your code, it would be:
[lua]local x, y = pilka.x, pilka.y[/lua]
This is true for physics bodies because Corona applies physics bodies directly to the display object. Therefore, the .x and .y values of the display object will be the same for the physics body, because they are the same thing. [import]uid: 8271 topic_id: 36057 reply_id: 143225[/import]

The position of any display object is always it’s .x and .y values. So, for your code, it would be:
[lua]local x, y = pilka.x, pilka.y[/lua]
This is true for physics bodies because Corona applies physics bodies directly to the display object. Therefore, the .x and .y values of the display object will be the same for the physics body, because they are the same thing. [import]uid: 8271 topic_id: 36057 reply_id: 143225[/import]

The position of any display object is always it’s .x and .y values. So, for your code, it would be:
[lua]local x, y = pilka.x, pilka.y[/lua]
This is true for physics bodies because Corona applies physics bodies directly to the display object. Therefore, the .x and .y values of the display object will be the same for the physics body, because they are the same thing. [import]uid: 8271 topic_id: 36057 reply_id: 143225[/import]

The position of any display object is always it’s .x and .y values. So, for your code, it would be:
[lua]local x, y = pilka.x, pilka.y[/lua]
This is true for physics bodies because Corona applies physics bodies directly to the display object. Therefore, the .x and .y values of the display object will be the same for the physics body, because they are the same thing. [import]uid: 8271 topic_id: 36057 reply_id: 143225[/import]