[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]

## Pixels vs Meters vs Object Coordinates Started by yazan21 Nov 26 2019 05:16 AM

pixels meters acceleration velocity motion
[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

### yazan21

[GLOBAL: userInfoPane.html]
yazan21
• Enthusiast

• 58 posts
• Corona SDK

When setting gravity the unit is m/s^2

When getting linear velocity the value returned is in px/s

I ran this code to get 2 y-position values and 2 y-velocity values.

```physics.setGravity(0,10)

projectile = display.newImageRect(layers.content, "images/circle.png", 20, 20 )
projectile.anchorY = 1
projectile.x = centerX - 200
projectile.y = 100

local function getValues()
local vx, vy = projectile:getLinearVelocity()
if projectile.y < 600 then
print("Position Y = " .. projectile.y .. " -- Velocity Y = " .. vy)
end
end

```

I then used the UARM motion formula (V2^2 - V1^2) / 2(y-displacement) = acceleration

to get the acceleration

I got 294.44 px/s^2 which is 0.0779 m/s^2 not 10 m/s^2

I figured this is because the y-displacement isn't the actual number of pixels covered but rather the scaled content area.

So then I converted 10 m/s^2 to px/s^2 and got 3779.5 px/s^2 then used that to get the y-displacement in pixels (V2^2 - V1^2) / 2(acceleration) = y-displacement and got the y-displacement to be 8.589 pixels which makes no sense!

Can someone please me where I went wrong?

[TOPIC: post.html]
#2

### yazan21

[GLOBAL: userInfoPane.html]
yazan21
• Enthusiast

• 58 posts
• Corona SDK

To avoid complicating things by using the object coordinates I just tried something much simpler.

I made the object free fall under the effect of only gravity, then got 2 y-velocity values: 0 px/s and 80 px/s and the time taken to reach the second velocity value being 425.8 milliseconds which is 0.4258 seconds.

Doing ( 80 - 0 ) / 0.4258 gives an acceleration value of 187.88 px/s^2 which is 0.0497 m/s^2 ,not 10 m/s^2 !

[topic_controls]

[/topic_controls]