My platform does not stop in solid

Discussion and feedback on Construct 2

Post » Tue Sep 08, 2015 7:51 pm

Hello!
I have a platform sprite "Bob" and a sprite "Bar" that is solid and bullet.
The bar spawns from the bottom of the layer and goes up, while Bob spawns from the top of the layer and falls.
Bob has to "stop" in a bar and wait to an other one apears and then let him falls to the other bar.
I have a little problem. When time pass, the bar gets faster, it means, it goes up faster. In a certain moment Bob stops to stop in the Bar. Why does this happen? Why a platform sprite can go thru solid?
Im sorry for my english. I do what i can.
Thank you for your help! This solution will help me to finish my game!!
B
4
Posts: 2
Reputation: 204

Post » Tue Sep 08, 2015 8:04 pm

If I understand the problem correctly, this seems to be typically what is referred to as "tunnelling", i.e. solid objects moving at relative high speed going through each other.

This can happen if the size and speed of Bob and Bar, and the framerate, are in a configuration when at frame n Bob is totally above the bar, and at frame n+1 bob is totally below Bar ; in this situation, Bob and Bar are never really in collision, since they move too much in one single frame

The usual solutions are time slicing (moving multiple times in smaller increments in one frame) and continuous collision detection (CCD, using swept volumes), though I'm not sure how you would solve this in C2...

You might try using a bigger hitbox to detect possible tunnelling, and then the accurate hitbox, in case of possible condition
Image
B
23
S
9
Posts: 237
Reputation: 2,207

Post » Tue Sep 08, 2015 8:15 pm

Thank you very much!!! Now im ussing a bigger hitbox in the Bar. And i also change solid behaviour for jumping thru. Now it works!
B
4
Posts: 2
Reputation: 204


Return to Construct 2 General

Who is online

Users browsing this forum: Glyfos, jefftrier and 7 guests