Page 1 of 5

Physics Issues

Posted: Wed Jan 18, 2012 3:06 am
by Refpeuk
Hi all,

My physics-based platform game is doing some weird stuff. When my character runs (collision block slides) from one shape to another he freezes and shows my jumping sprite. I have no clue why this is - shouldn't it just slide?

I've attached my .love file.

Thanks

Re: Physics Issues

Posted: Wed Jan 18, 2012 4:28 am
by MarekkPie
I can't even get it to load. When I run it from the terminal I get this:

Code: Select all

[redacted]:~/Downloads/LOVE$ love platformer/
love: modules/physics/box2d/Source/Collision/Shapes/b2PolygonShape.cpp:225: b2PolygonShape::b2PolygonShape(const b2ShapeDef*): Assertion `d.y >= 0.0f' failed.
Aborted
[redacted]:~/Downloads/LOVE$ 
I haven't used the physics module yet, so I won't even know where to start.

Re: Physics Issues

Posted: Wed Jan 18, 2012 5:04 am
by Refpeuk
Hmm, interesting. I know it works; I've tried that exact file. It's built for 0.7.2, I can confirm it doesn't work in 0.8.0 so maybe that's the issue.

Anyway, no matter. I came up with a solution; the issue was how I was handling collision callbacks and enabling/disabling jump. I changed it to a counter instead of a boolean and now it works fine.

Sorry for the pointless post. If anyone wants to look through my code feel free to give as much (hopefully constructive) criticism as you want. As this is my first game it's a real learning experience.

Thanks for the reply Marekkpie, it seems as you're always around to help. :awesome:

I've attached my fixed code so anyone who wants to can learn from my mistake. (I forgot to mention in my first post, you can place blocks with lmb, move them with rmb, and select different types of blocks to place with the number keys.)

Re: Physics Issues

Posted: Wed Jan 18, 2012 5:08 am
by MarekkPie
No problem. Reading the error code some more, it looks like it is a C issue, and for whatever reason, one of your shapes had a nonpositive float.

Re: Physics Issues

Posted: Wed Jan 18, 2012 8:52 am
by Robin
MarekkPie wrote:No problem. Reading the error code some more, it looks like it is a C issue, and for whatever reason, one of your shapes had a nonpositive float.
It means that a shape was too small. Box2D only works with shapes in a certain size range.

Re: Physics Issues

Posted: Wed Jan 18, 2012 4:18 pm
by Refpeuk
Why does it not give me that error? Is anyone else able to run it?

Re: Physics Issues

Posted: Wed Jan 18, 2012 6:52 pm
by Nixola
Maybe, but not me

Re: Physics Issues

Posted: Wed Jan 18, 2012 9:51 pm
by Ellohir
I have run it, though I have PO2 so instead of a player I see a white box. But a very nice and jumpy white box :awesome:

Re: Physics Issues

Posted: Wed Jan 18, 2012 10:28 pm
by MarekkPie
Still can't get it to run. The only other thing may be that in fiddling with other random engines, some library or dependency was overwritten.

Re: Physics Issues

Posted: Thu Jan 19, 2012 4:37 pm
by Refpeuk
This is really strange: I thought the code was supposed to be portable. How dis you run it? I use love 0.7.2 and drag the .zip or .love onto a love.exe inside the folder with DevIL.dll, OpenAL32.dll, and SDL.dll.

When it doesn't work does it crash to desktop with a windows "love.exe" stopped working error, or do you get a love error message.

PS: What's PO2, Ellohir?