简体   繁体   中英

How to convert pixels into meters in a 2D world?

First of all I'm not using box2d which means I cannot just invent a number and make it the value of ppm. What I'm trying to do is something like this , but the user can set the altitude of the object. When I implemented gravity without air resistance the time it took to hit the ground was around 1.4 seconds, and the starting altitude of my object/sprite was around 590 pixels. Then I used a calculator to calculate the altitude into meters, and it was around 9.6m (if the object fell for 1.4 seconds). But then I don't know how to calculate the amount of pixels required for each meter, it is more confusing since that the velocity y of the object increases by 9.8 pixels per second because there is no air resistance. Thanks in advance

590px/9.6m = 61.458 pixels to a meter. Round as you would prefer.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM