fast collisions?
haze87
Member Posts: 3
is it normal that sometimes when my actor is falling too fast doesn't collide? somebody else has the same problem?
Comments
Yes, if actors are moving too quickly it's not uncommon to miss the collision.
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page
eww... is there a way to fix this with some rules??
Slow things down...
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page
Think of it like this . . . . .
Let's say GameSalad runs at 60fps.
Let's also say the project is iPad landscape, so 1024 x 768 pixels.
And, obviously, to detect a collision between two actors they have to overlap.
. . . . . .
Now let's imagine we have a floor actor that runs all the way across a scene, it is 20 pixels high, and sits on the bottom of the scene, so its lower point is y=0 and its highest point is y=20.
And we also have a 100x100 pixel actor rapidly falling towards the floor actor from the top of the screen (y=768)
. . . . . .
If that actor is falling so fast that frames 0, 1, 2, 3, 4, 5 and 6 (1/10th of second) take it from the top of the screen to just above the floor actor, so between each frame we move 124.66 pixels ((768 pixels - 20 pixels) / 6 frames).
So now the actor is just above the floor actor . . . . we move onto the next frame, frame 7, at 1/60th of second later, which is another 124.66 pixels down - now as the floor actor is only 20 pixels high, the falling actor will completely jump over it and no collision will take place as the two actors were never in the same place at the same time.
Hope that make sense !
. . . . . .
There are numerous solutions to this, hopefully if you can see what the issue is a solution shouldn't be too hard to work out . . . like Jamie said 'Slow things down', make a thicker floor (in the above scenario at least 124.66 deeper) etc etc.
good explanation, now i get it clear