Box2D Note
Re: Box2D Note
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
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.rude wrote:Of course that's possible, but it would involve one multiplication for each ingoing and outgoing numeric value[...]
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
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. ^_^
Added to task list, and thanks for the tip. ^_^
Re: Box2D Note
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).
*EDIT* No, no it isn't. I wasn't using the physics engine in any regard (that I was aware of).
"Any sufficiently advanced technology is indistinguishable from magic." - Arthur C. Clarke
Re: Box2D Note
I wish the source-physics engine used MKS... Instead it uses InchPoundSecond...
I r awsum at looah
-
- Party member
- Posts: 215
- Joined: Sun Jan 18, 2009 8:03 pm
Re: Box2D Note
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
If I haven't written anything else, you may assume that my work is released under the LPC License - the LÖVE Community. See http://love2d.org/wiki/index.php?title=LPC_License.
Re: Box2D Note
Thanks for noting that, osuf. But why do you need shapes that are (much) less than a pixel wide?
-
- Party member
- Posts: 215
- Joined: Sun Jan 18, 2009 8:03 pm
Re: Box2D Note
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.rude wrote:Thanks for noting that, osuf. But why do you need shapes that are (much) less than a pixel wide?
If I haven't written anything else, you may assume that my work is released under the LPC License - the LÖVE Community. See http://love2d.org/wiki/index.php?title=LPC_License.
Re: Box2D Note
Oh, in Camera. I see.
Who is online
Users browsing this forum: No registered users and 3 guests