Huh. I'm trying to use love's physics, but I just discovered that any velocity numbers > than 200 are chopped down to 200. I don't know why, I just know that they are. And that it's annoying. Moving faster than 200 is a must.
Here's a love file that demonstrates this cropping velocity down to 200. If I'm missing something, please tell me now.
Max velocity = 200, why?
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Max velocity = 200, why?
- Attachments
-
- velocityFAIL.love
- (651 Bytes) Downloaded 293 times
Re: Max velocity = 200, why?
Huh, also: love crashes if a world has 2000 or more physics objects. (actually, I think it's 2048)
Last edited by Almost on Sun Sep 06, 2009 3:42 am, edited 3 times in total.
Re: Max velocity = 200, why?
whats the objects mass?
Re: Max velocity = 200, why?
Re: Osgeld
the mass is 1, but that shouldn't matter to setVelocity()
the mass is 1, but that shouldn't matter to setVelocity()
Re: Max velocity = 200, why?
It looks like the 200 m/s limit is a feature of the underlying "Box2D" so you have to scale your simulation to within the limits.
Re: Max velocity = 200, why?
Code: Select all
function update(dt)
world:update(X * dt)
end
- Attachments
-
- main.lua
- (190 Bytes) Downloaded 283 times
Re: Max velocity = 200, why?
doh, that is a clever fix. I still have issues with 2000+ physics objects though.. I guess I'll just have to have fewer objects..
Last edited by Almost on Sun Sep 06, 2009 5:43 am, edited 1 time in total.
Re: Max velocity = 200, why?
you can have smaller physical worlds, depending on your need for accuracy and scale to shown perspectives, its all a matter of scale
PS: just cause I was bored ....
PS: just cause I was bored ....
Code: Select all
function load()
love.graphics.setFont(love.default_font,12)
world = love.physics.newWorld(1000,1000)
body = {}
for i = 1, 6 do
table.insert(body, love.physics.newBody(world,100,(i *100)))
end
for i = 1, #body do
body[i]:setVelocity((5 * i),0)
end
end
function update(dt)
world:update(50 *dt)
end
function keypressed(key)
if key == love.key_r then
world = nil
body = nil
collectgarbage("collect")
load()
end
end
function draw()
for i = 1, #body do
local x, y = body[i]:getPosition()
love.graphics.circle(love.draw_fill,x,y,10)
love.graphics.draw('Expected Speed: ' .. (i * 5) ,10,y-15)
love.graphics.draw('Actual Speed: ' .. body[i]:getVelocity() ,10,y)
end
love.graphics.draw('R to restart',10,10)
end
Re: Max velocity = 200, why?
From b2Settings.h:
This limit is very large if you use Box2D as it's intended. In LÖVE 0.5.0, one meter is 1px (not good). In LÖVE 0.6.0 you can set how many pixels one meter should be.
Also b2Settings.h:
That's the limit of how many shapes you can have.
Code: Select all
/// The maximum linear velocity of a body. This limit is very large and is used
/// to prevent numerical problems. You shouldn't need to adjust this.
const float32 b2_maxLinearVelocity = 200.0f;
Also b2Settings.h:
Code: Select all
const int32 b2_maxProxies = 2048;
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: Max velocity = 200, why?
You can change that with CAMERAs. That's how we did it in LovelyBigPlanet.rude wrote:In LÖVE 0.5.0, one meter is 1px (not good)
Help us help you: attach a .love.
Who is online
Users browsing this forum: Ahrefs [Bot] and 5 guests