Hello, newbie here.
I'm making a simple platformer game using love.physics for all the physics. I have a map where the platforms are made by many 32x32 blocks put together in order to create a perfect, bigger platform (with no separation or differences between the blocks).
However, rarely (not so rarely) my player get stuck right where two blocks meet.
Any ideas for handling this?
Thanks!
Getting stuck between adjacent objects
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Getting stuck between adjacent objects
- Attachments
-
- platformer.love
- (11.24 KiB) Downloaded 135 times
Re: Getting stuck between adjacent objects
It must have something to do with the way you handle collisions. It might make sense to copypaste the corresponding code here.
Re: Getting stuck between adjacent objects
General advice for platformers is to avoid using physics engines, (i've specifically heard people say not to use box2d in fact, which is what love.physics uses behind the scenes.
You are probably best off just using bounding-boxes or even tile-based collisions.
If you prefer to use love.physics (if you're doing this in part to familiarize yourself with it for example), give us some code so we can help find the issue.
You are probably best off just using bounding-boxes or even tile-based collisions.
If you prefer to use love.physics (if you're doing this in part to familiarize yourself with it for example), give us some code so we can help find the issue.
Re: Getting stuck between adjacent objects
Thank you for the replies! I did some research and I found out that is better to treat a long platform as just one big collision box. Actually I had tought about this but now I realize that you can do this much more easily with Tiled
Re: Getting stuck between adjacent objects
This is a common issue, and not easy to fix. I've experienced it even in famous commercial games such as Need for Speed Most Wanted in PS2: you are running in contact with a wall, and suddenly you collide with something that is not there, but only sometimes: you go back a bit, try to hit that invisible wall again and this time it goes through without problems.
TheHUG's advice is sound, but avoiding this specific issue is a pain. Bump tries to avoid it by checking collisions with the closest box first. It usually works, but it doesn't always succeed.
This blog mentions Bump's solution: https://hopefultoad.blogspot.com/2017/0 ... ponse.html
In this other blog the approach is different, and it sounds more general to me: http://metareal.net/blog/?p=69 (see "Snagging on seams").
EDIT: Or just what you said!
TheHUG's advice is sound, but avoiding this specific issue is a pain. Bump tries to avoid it by checking collisions with the closest box first. It usually works, but it doesn't always succeed.
This blog mentions Bump's solution: https://hopefultoad.blogspot.com/2017/0 ... ponse.html
In this other blog the approach is different, and it sounds more general to me: http://metareal.net/blog/?p=69 (see "Snagging on seams").
EDIT: Or just what you said!
Who is online
Users browsing this forum: Google [Bot] and 6 guests