Page 2 of 2
Re: Box2D Note
Posted: Mon Oct 20, 2008 1:34 am
by cag
I second muku's proposition. LOVE is already kinda meant to work on modern processors, so programmer vs. computation time-wise, it's probably better to specify a single pixel-to-meter scale and take the negligible computation hit than to have the programmer work out values in meters themselves.
Re: Box2D Note
Posted: Thu Oct 23, 2008 4:06 pm
by u9_
rude wrote:Of course that's possible, but it would involve one multiplication for each ingoing and outgoing numeric value[...]
But aren't you fixing the engine to a predetermined resolution? I am worried that this is crippling LOVE a little, and think that if possible, pixels and your world model should be independent. This is good programming practice, albeit maybe a little advanced for newbies. But then again, when you turn to a physics engine, you are already pretty advanced IMHO.
Another thing is that I would like to see LOVE on other devices in the future, such as the upcoming
Pandora. These devices have a very different resolution.
Maybe a function could be provided that defined the size of a pixel in meters?
/u9
P.s. I have yet to make my first "love" yet, so I may be way off.
Re: Box2D Note
Posted: Thu Oct 23, 2008 6:37 pm
by rude
Pixels should be used by default though, if LOVE wants to keep its "easy to use" status. Otherwise, there's nothing wrong with separating the world model and viewport. It simply involves exposing a function like love.graphics.setViewport or something, which should take around 5 minutes.
Added to task list, and thanks for the tip. ^_^
Re: Box2D Note
Posted: Thu Oct 23, 2008 7:41 pm
by Xfcn
So is this why my jumping dude was so damn difficult to fine-tune?
*EDIT* No, no it isn't. I wasn't using the physics engine in any regard (that I was aware of).
Re: Box2D Note
Posted: Sun Nov 16, 2008 1:55 pm
by MHD
I wish the source-physics engine used MKS...
Instead it uses InchPoundSecond...
Re: Box2D Note
Posted: Mon Feb 02, 2009 1:45 pm
by osuf oboys
There seems to be limitation in the lower size of shapes as well. The following crashes on fedora core 9 and supposedly also on OSX. On windows, it does not crash but issues are visible with small shapes, like objects that get stuck in each other. In my experiences, the smallest unit of visible shapes that you want is 300ths to 600ths of the screen width or height. Considering that shapes smaller than 0.08 cannot be used, this dictates that the screen should be at least 24 to 48 metres wide. Scaling everything down 80 times is therefore not an option - a 800x600 resolution would have a width of 10 metres, thereby making the smallest shape only a 100th of the screen. Scaling by 1/20 would be more desirable.
Code: Select all
world = love.physics.newWorld(5,5)
body = love.physics.newBody(world, 0, 0)
shape = love.physics.newRectangleShape(body, 0.08, 1.0) -- works
shape = love.physics.newRectangleShape(body, 0.07, 1.0) -- crashes
Re: Box2D Note
Posted: Mon Feb 02, 2009 2:20 pm
by rude
Thanks for noting that, osuf. But why do you need shapes that are (much) less than a pixel wide?
Re: Box2D Note
Posted: Mon Feb 02, 2009 2:27 pm
by osuf oboys
rude wrote:Thanks for noting that, osuf. But why do you need shapes that are (much) less than a pixel wide?
In camera,
http://love2d.org/forum/viewtopic.php?f=5&t=419, I create bodies that are of normal size, such as 2 meter humans instead of 40 pixels = 40 metres, to avoid the problem of making too large shapes. I have overloaded the love.graphics functions to scale these shapes out appropriately on the screen. An object 0.08 = 8cm wide might be drawn on the screen as 5 pixels following this scheme.
Re: Box2D Note
Posted: Tue Feb 03, 2009 12:50 pm
by rude
Oh, in Camera. I see.