Question regarding measuring units

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
User avatar
misterspok
Prole
Posts: 20
Joined: Fri Apr 19, 2013 12:40 pm

Question regarding measuring units

Post by misterspok »

Hello again,

It's been a long time since I tried to communicate with this community. Previous experience wasn't very pleasing. But I hope to get some feedback this time.
(And again, I'm not a native english speaker. So I apologize for any mistakes in this and other posts. It's not on purpose.)

I'm currently working on my game project, and I already have a working math and physics in pure Lua. So it is time to move it into LOVE. But I am not very sure about measuring units LOVE use. As a matter of fact, my game use real-world measuring units, such as: meters, kilograms, meters per second, seconds.

So the question is: Am I constrained to pixels in LOVE, or pixel can represent any measuring unit (meter, for instance)?

I must apologize, as this question may seem noob-ish for you. But I hope you can help me in this matter. Thank you.
User avatar
micha
Inner party member
Posts: 1083
Joined: Wed Sep 26, 2012 5:13 pm

Re: Question regarding measuring units

Post by micha »

Whenever you draw something in LÖVE, then the number you put into the drawing-command measures in pixel.

However, it is a good idea to separate the in-game mechanics from the graphics. This is what you do, since your calculations are in meters. All you need is the functionality, that calculates the screen coordinates (in pixel) given the physical coordinates (in meters). This is often done by some sort of camera library. But it is also not difficult to write it your self using love.graphics.translate and love.graphics.scale.
User avatar
misterspok
Prole
Posts: 20
Joined: Fri Apr 19, 2013 12:40 pm

Re: Question regarding measuring units

Post by misterspok »

I looked at the scale function in the Wiki, and I think that this is what I really need! This way I can make my physics module to think that, say, 1 pixel is 1 centimeter, and then scale axises as I want! Thank you for that tip :)

P.S. I still think that this forum should get Q&A thread, so nobody has to start a new thread to ask a question like this one. Maybe moderators could react, at least somehow?
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Question regarding measuring units

Post by bartbes »

misterspok wrote:P.S. I still think that this forum should get Q&A thread, so nobody has to start a new thread to ask a question like this one. Maybe moderators could react, at least somehow?
We have an entire subforum dedicated to questions, and a search function. This is definitely a better resource than some FAQ.
If instead you mean a thread where everyone can ask their questions, what would be the difference? Except for it being harder to find, read, etc.
User avatar
misterspok
Prole
Posts: 20
Joined: Fri Apr 19, 2013 12:40 pm

Re: Question regarding measuring units

Post by misterspok »

Well, I just thought it will be more convenient. But if you say so, let it be as it is.

Anyways. Thanks to Micha's heads up and my VERY scarce knowledge of LOVE, after about hour and a half I now have a working prototype of my project! It displays main flight data and daws a trajectory :) You also can change engine power and burn vector angle using WSAD keys, and burn when LMB pressed. I implemented real liquid fuel rocket engine physics and real atmosphereless flight model.
Post Reply

Who is online

Users browsing this forum: slime and 7 guests