Collision problem

0 favourites
  • 7 posts
  • 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!

  • It gets extremly annoying when jumping on an enemy do hurt your character

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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

  • 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...

    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

  • [quote:3k8y5269]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 !

  • 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.

  • 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.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)