Page 66 of 91

Re: "Questions that don't deserve their own thread" thread

Posted: Fri Jul 15, 2016 7:44 pm
by pgimeno
airstruck wrote:How is world gravity measured in love.physics? Is it meters per second per second? Setting the world gravity to (0, 9.8) feels really floaty, what's going on?
Probably that you need to call [wiki]love.physics.setMeter[/wiki] before [wiki]love.physics.newWorld[/wiki]. The default is 30 I think.

Edit: Yes, the units are m/s².

(Been there myself)

Re: "Questions that don't deserve their own thread" thread

Posted: Fri Jul 15, 2016 7:55 pm
by bartbes
pgimeno wrote: Edit: Yes, the units are m/s².
No, it's not m/s², it's unit/s², where "unit" is whatever is defined using setMeter. So by default, with a scale of 30, that means 30*9.8=294 would act like earth gravity, if indeed you use 30px/meter.

Re: "Questions that don't deserve their own thread" thread

Posted: Fri Jul 15, 2016 8:31 pm
by airstruck
Got it, was just playing around with it and 300 felt about right. Not sure what the rationale is behind this, it seems pretty counterintuitive to be honest. For things that deal with positions, scaling up or down makes things easier for the user, but this just seems to make things more complex. /2¢

Re: "Questions that don't deserve their own thread" thread

Posted: Fri Jul 15, 2016 8:59 pm
by slime
Someguynamedpie wrote:Not so much that as its just not defined in the spec IIRC creating undefined behavior.
It's not defined in the spec because desktop GPU hardware works in a way that prevents that from working as you'd expect. :)

Re: "Questions that don't deserve their own thread" thread

Posted: Fri Jul 15, 2016 9:21 pm
by bartbes
airstruck wrote:Not sure what the rationale is behind this, it seems pretty counterintuitive to be honest.
Why? Everything is in the same unit, mixing units would make things weird.

Re: "Questions that don't deserve their own thread" thread

Posted: Fri Jul 15, 2016 11:27 pm
by pgimeno
Bartbes is right, my bad. I tend to think that setMeter is the pixels per metre conversion and that's not quite correct. It's actually for length unit conversion. Setting it to 1/0.0254, for example, would make your length unit be inches (mass is still kg, though).

In my opinion, the only weird thing is the default value of 30.

Re: "Questions that don't deserve their own thread" thread

Posted: Sat Jul 16, 2016 12:19 am
by Someguynamedpie
You can also make the units inches, feet, kilometers, lightyears, there is no real "unit" unless you make it yourself.

Re: "Questions that don't deserve their own thread" thread

Posted: Sat Jul 16, 2016 12:21 am
by airstruck
bartbes wrote:Why? Everything is in the same unit, mixing units would make things weird.
I suppose. My gut feeling is that it would be less weird / more convenient / more intuitive if "setMeter units" were only used for stuff that actually benefit from setMeter being a "convenient way to draw the objects directly to the screen without the need for graphics transformations." Maybe it would just be weird though, I don't know. I do hope that if the simplified physics API that's been discussed is ever put into place, setMeter moves over there and the current physics API ditches all the Physics:scale* stuff and switches over to meters for everything.
Someguynamedpie wrote:You can also make the units inches, feet, kilometers, lightyears, there is no real "unit" unless you make it yourself.
Box2d uses meters, I'm suggesting that it might be good for love.physics to do the same in some cases, and not just use "setMeter units" everywhere.

Re: "Questions that don't deserve their own thread" thread

Posted: Sat Jul 16, 2016 12:28 am
by Someguynamedpie
I know box2d uses meters but the point is you can "use" whatever you want because they're just numbers

Re: "Questions that don't deserve their own thread" thread

Posted: Sat Jul 16, 2016 12:39 am
by airstruck
Someguynamedpie wrote:I know box2d uses meters but the point is you can "use" whatever you want because they're just numbers
Yes, I understand the point you're making, but I don't see how it's relevant to the conversation. I don't care what the units are interpreted as in my own or anyone else's user code, I'm talking about what units love.physics expects values to be in, relative to everything else love.physics is doing.