Platformer Prototype
Re: Platformer Prototype
that's dt for you
Re: Platformer Prototype
I added a fixed timestep now. Aka you can't fall through the floor when moving the window anymore.
http://dl.dropbox.com/u/28079852/PlatformerProto14.love
http://dl.dropbox.com/u/28079852/PlatformerProto14.love
- BlackBulletIV
- Inner party member
- Posts: 1261
- Joined: Wed Dec 29, 2010 8:19 pm
- Location: Queensland, Australia
- Contact:
Re: Platformer Prototype
I wouldn't use a fixed timestep, it's better to limit how much delta time Box2D gets access to:
Another way to fix this problem (by my observations) would be to use Body:setBullet. Set that to true, and Box2D will check for collision in a "real-time" way.
Code: Select all
local left = dt
local step = .03
while left > 0 do
world:update(step)
left = left - step
end
Re: Platformer Prototype
I'm curious, does this microstep/window movement phenomena only apply to box2D-style physics? I plan on making a platformer one day and I was wondering if I'd have to take this into account using pseudo physics.
Do you recognise when the world won't stop for you? Or when the days don't care what you've got to do? When the weight's too tough to lift up, what do you? Don't let them choose for you, that's on you.
- bartbes
- Sex machine
- Posts: 4946
- Joined: Fri Aug 29, 2008 10:35 am
- Location: The Netherlands
- Contact:
Re: Platformer Prototype
It depends on your calculations, but most calculations do, in fact, need small timesteps for them to at least look like they're accurate.
So, in general:
The smaller the timestep, the more accurate the result. (in most cases, if you recalculate from the start, this is not the case)
Now, as for why this is, these formulas have been created and verified with dt approaching 0, if that means anything to you.
So, in general:
The smaller the timestep, the more accurate the result. (in most cases, if you recalculate from the start, this is not the case)
Now, as for why this is, these formulas have been created and verified with dt approaching 0, if that means anything to you.
Re: Platformer Prototype
I am not using box2d. I made everything myself!
- BlackBulletIV
- Inner party member
- Posts: 1261
- Joined: Wed Dec 29, 2010 8:19 pm
- Location: Queensland, Australia
- Contact:
Re: Platformer Prototype
The problem would come from the fact that calculations are done using the delta time. For example:
The longer the delta time, the more that it added to the position of the object. Unless setBullet is set to true, Box2D will just move the object by whatever body.vx * dt happens to be without checking whether anything was in between.
EDIT: 777 posts!
Code: Select all
body.x = body.x + body.vx * dt
Ah ok, but the same thing still applies. When doing your physical updates, limit the delta time as I showed above.DrLuke wrote:I am not using box2d. I made everything myself!
EDIT: 777 posts!
Re: Platformer Prototype
when the player stand on ground and i hit right(or left) gently, player will Jitter.
Re: Platformer Prototype
Yeah, that's a problem with the friction, soon to be solved.bmzz wrote:when the player stand on ground and i hit right(or left) gently, player will Jitter.
Re: Platformer Prototype
Fasten your seatbelts and don't let any limbs hang outside of the table's boundaries, I'm presenting you:
Collisions with triangles!
http://dl.dropbox.com/u/28079852/Collisions16.love
Collisions with triangles!
http://dl.dropbox.com/u/28079852/Collisions16.love
Who is online
Users browsing this forum: No registered users and 5 guests