Collision problem

Get help using Construct 2

Post » Mon Jan 19, 2015 12:25 pm

Did anyone notice collision problems, when running on lower fps around 20 {on mobiles}? Still didn't found any solution to this and altough i plan to use WKWebview, i would expect them to work even on 20 fps!
B
8
S
4
G
1
Posts: 191
Reputation: 1,873

Post » Mon Jan 19, 2015 12:26 pm

It gets extremly annoying when jumping on an enemy do hurt your character
B
8
S
4
G
1
Posts: 191
Reputation: 1,873

Post » Mon Jan 19, 2015 12:45 pm

Tunneling is an inherent problem of collision detection using discrete timesteps ; the framerate is actually irrelevant, as this can always happen as long as an object is moving "fast enough" (compared to its size).

I haven't used the physics module of C2 yet, so I don't know any good solution from top of my head, but see if you find anything that relates to continuous collision detection (CCD, raychecks, extrusion, etc.) ; otherwise you might have to do some linecheck or swept surfaces manually.

Alternatively, maybe use an additional bigger hitbox that's big enough given your level design to prevent tunneling ; knowing that when your larger box detects a collision but your smaller one doesn't, a collision *might* have happened, and you'll need more computations to know what actually happened
Last edited by Refeuh on Mon Jan 19, 2015 1:07 pm, edited 1 time in total.
Image
Game Producer & Independent Developer - http://raphaelgervaise.com
B
24
S
9
Posts: 237
Reputation: 2,232

Post » Mon Jan 19, 2015 12:50 pm

Hi Refeuh,

actually, it only happens on my iphone. On my desktop, it didn't happen a single time and i checked that a lot of times. Therefore i asume, that it caused by lower fps.
Will try though with a biger bounding box how it behaves...



Refeuh wrote:Tunneling is an inherent problem of collision detection using discrete timesteps ; the framerate is actually irrelevant, as this can always happen as long as an object is moving "fast enough" (compared to its size).

I haven't used the physics module of C2 yet, so I don't know any good solution from top of my head, but see if you find anything that relates to continuous collision detection (CCD, raychecks, extrusion, etc.) ; otherwise you might have to do some linecheck or swept surfaces manually.

Alternatively, maybe use an additional bigger hitbox that's big enough given your level design to prevent tunneling ; knowing that your large box detects a collision but your smaller one doesn't, a collision *might* have happened, and you'll need more computations to know what actually happened
B
8
S
4
G
1
Posts: 191
Reputation: 1,873

Post » Mon Jan 19, 2015 1:06 pm

it only happens on my iphone. On my desktop, it didn't happen a single time and i checked that a lot of times


There is a correlation between framerate, object size and object speed that explains when tunneling can or cannot happen. What I meant when I said the framerate was "irrelevant" is that 30 or 60fps, or even 120fps, doesn't guarantee consistent collision detection ; if you had smaller or faster moving objects at 60fps, you could see the same issue.

Commercial games use solutions that work decently in all situations ; for example a bullet in a first person shooter, a small and fast moving object, is never actually a bullet from a physics representation point of view, it's a line, and physics raychecks are used to compute collisions so that bullets don't through thin walls.

As for doing this with C2... :-? No idea, honestly. But the problem is well-known.

'Hope that helps a bit !
Image
Game Producer & Independent Developer - http://raphaelgervaise.com
B
24
S
9
Posts: 237
Reputation: 2,232

Post » Mon Jan 19, 2015 1:11 pm

Maybe... if you have animations for moves like dashing, falling, etc. use larger hitboxes specifically on these to counterbalance the movement speed. Assume a minimum framerate of 15fps, and given the size and speed of your object, and the size of other entities, you should know the size of a hitbox that can never tunnel through enemies or environment bits.
Image
Game Producer & Independent Developer - http://raphaelgervaise.com
B
24
S
9
Posts: 237
Reputation: 2,232

Post » Mon Jan 19, 2015 3:05 pm

Refeuh wrote:Maybe... if you have animations for moves like dashing, falling, etc. use larger hitboxes specifically on these to counterbalance the movement speed. Assume a minimum framerate of 15fps, and given the size and speed of your object, and the size of other entities, you should know the size of a hitbox that can never tunnel through enemies or environment bits.


I just tested on Webview+ and there's no errors. So that's one good message. I tried to make the bounding box of my character bigger, but that didn't helped.
B
8
S
4
G
1
Posts: 191
Reputation: 1,873


Return to How do I....?

Who is online

Users browsing this forum: badmoodtaylor, brunopalermo, dand, piranha305, tinhofiel and 29 guests