Page 1 of 1
Crashing problems
Posted: Mon Jul 19, 2010 1:33 pm
by FoiL
So, after a couple of years I picked up love once again. My goal still being achieving something along the lines of
this little thing. And so so far I think I have the movement down, but sometimes it just crashes. The dt variable is still updated, but the little triangle thing just stops moving.
Re: Crashing problems
Posted: Mon Jul 19, 2010 2:05 pm
by kikito
I suspect the problem is that the triangle "exits" the world (which is 400x400 units).
When box2d objects "get out of the world" they enter a state known as "frozen", on which they don't answer to impulses or forces any more.
If this is the case, one possible solution would be to surround your world with 4 fixed (mass = 0) rectangles on the frontiers. Another one is detecting that the tank is approaching the world's limits and put it somewhere else. For example, on the opposite side of the map (like pacman).
Regards!
Re: Crashing problems
Posted: Mon Jul 19, 2010 4:21 pm
by FoiL
Yeah, I felt really stupid when, literally, 2 minutes after posting the thing I looked at the code and solved it. Oh well.
Mind if I use this thread as a general questions thing?
Re: Crashing problems
Posted: Tue Jul 20, 2010 7:08 am
by kikito
I'd recommend using a different thread per question. That'll make answers more easily searchable for others.