Strange Floor Collision Glitch
This is something I've been struggling with for a while, but I finally was able to consistantly reproduce a form of it, so I thought I'd ask about it.
Baiscally, my platforming style game has this glitch where the character sometimes gets stuck at the edge of floors. The floor is made of blocks varying from 64 to 256 pixels wide, lined up exactly, so the sticking would happen when it touched a corner. It was never consistant. However, I have discovered that if the player gets an impact from above that carries any force, like an enemy landing on them, this gets the player consistantly caught, though he can back away from the corner, until he jumps at least once.
The player collides with all Floor Tag actors, and detects when it is on the floor surface by use of a bounding box that extends two pixels below him that is constrained to him. But even if that box is gone he should still be able to move freely left and right. So my assumption is that somehow the impacts are pushing him INTO the surface slightly, so that it reads his collision box below the surface of the block and therefore coming up against the side of the second block. Anyone have a suggestion for how to fight this action so that it happens less? I can produce chunks of code on request but theres a LOt of different elements so if you can think of a way to keep his Y velocity/position consistant when hes on the ground but still able to jump or fall off, thats probably what im looking for.
Comments
Its been a couple months and I'm sorry to ressurect this issue, but I juts confirmed for myself again that it is still in place and I CANNOT fix this. An enemy prone to the same issue, i turned off his downward acceleration and affixed his position one pixel above the floor(one pixel between his actor and it) while leaving his movement model alone, and now it never sticks. Therefore, something in the collision model between connected floor pieces is causing this, and I just need to know if anyone has seen this problem before and what they did to fix it.
Instead of using your actual platforms to collide with, you could use just as scenery and then use a separate invisible actor as the collision box. Then you could just drag the collision box actor to any single size you need it each time.
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page
I create my levels through spawned tables, though. (the editor didnt like me making the levels directly in the field), so I dont know if that would work?
I guess if you could figure out a way to spawn the collision shapes from the table too it might work.
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page
I always use a separate invisible collision box for my characters and give that a slight angle offset so it always slides over seems without getting stuck.
Can you explain the angle offset bit? Like, its tilted up slightly? I experimented with it slightly, but it causes a strange issue with sliding on the edges of platforms whenever the entire collision box isnt on a platform, like its tipping over the edge.