I was messing about trying to make a barebones platformer, but randomly the player shape, instead of being repelled when it collides into another, just "jitters" about inside it. It doesn't always happen when I run it, but if it does, then it'll happen for the rest of the time it's open. As per the title, I'm using HardonCollider for collision detection. It's kinda hard to simulate since I have no idea what's causing it and it doesn't always happen, so I'll include some screenshots of what happens.
The code is pretty messy since I'm new to love, and because I just wanted something that works before making it look good, but there isn't much too it, so it shouldn't be too hard to read.
If you have a better ways of doing things (gravity, collision detection, etc.), please tell me.
http://imgur.com/eCNU9bz
http://imgur.com/5a2OMmp
edit: I figured out what was causing it. Sometimes the player shape is shape_b rather then shape_a, and in that case, the minimal translation vector was for how much the floor needed to move out of the way. I added an check to see if that's the case, and if so, to have x subtracted by mtv_y/mtv_x rather then added. It works fine now, but I still feel like I'm missing something, since I have never seen that in any of the example code I've seen or tutorials. Is there a more elegant solution? In any case, it works now.
HardonCollider Bug? - Shapes "jittering" in another
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
HardonCollider Bug? - Shapes "jittering" in another
- Attachments
-
- test.love
- (19.35 KiB) Downloaded 127 times
Re: HardonCollider Bug? - Shapes "jittering" in another
The order of the arguments for shapes aren't guaranteed so it is not a bug. You'll just have to check in the callback.
Who is online
Users browsing this forum: Google [Bot] and 12 guests