0 Favourites

comparing distance vs collision detection

  • Is it possible that comparing the distance between objects would be faster then comparing collisions/overlapping objects? I guess this would create a purely radial "collision" but if it could increase performance...

  • no, collision detection is optimized.. it wouldn't be any good if doing your own collision testing was better/faster.

    better to have less points in your collision poly

    also put collision triggers in groups that can be deactivated when you know for sure those objects are not to be tested for collisions.

  • Is it possible that comparing the distance between objects would be faster then comparing collisions/overlapping objects? I guess this would create a purely radial "collision" but if it could increase performance...

    If you do it correct it will increase performance a great deal using distance rather than pure collision. Like if you use a distance check to turn off collision of objects that are more than X distance from what needs to be checked. There have been a lot of discussion about this topic and some say it doesn't work. But personally from my own tests and experience, I would still use "Is overlapping" and distance checks, and as much as possible avoid "On collision" if I want the best performance. But again that's just my experience and not going to get into a discussion regarding this topic again, so its just my advice

  • You do not need to optimize your collision checks that way - Render Cells ensure that such actions are superfluous. On Collision demands more of the engine than Is Overlapping checks, but Is Overlapping will give True if one instance is overlapping and will not trigger again if a second occurs while the first is still true (in case you use Trigger Once, it will only trigger for the first Is Overlapping), so use it wisely to give best performance but understand its limitations. Read through this thread for a complete discussion on testing for collisions.

  • but Is Overlapping will give True if one instance is overlapping and will not trigger again if a second occurs while the first is still true

    oh cool, I wasn't aware of this... I only use isOverlapping for laser beams...good to know, thanks!

  • While I got you guys here. My game has been crashing since I put ads in. I've exported with coocon.js to android. How can I check the log to see where the crash is happening? And if it's in the cocoon launcher, that kind of defeats the purpose because the test ads work fine.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • I don't think cocoon.js is still supported... I don't use it myself.. but you may want to look into it..

  • I just find cocoon performs so much better then webview. And it's not all blurry either. Maybe the new construct release is just not getting along with cocoon anymore? Blah. The only problem i've encountered is this with the ads. When I tested with XDK I was getting all sorts of weird stuff happening. Plus it ran pretty bad... and looked blurry. It's frustrating. Been working a while on my game and it's like a download thats stuck at 99% lol

  • Every single collision check first verify if the bounding boxes are overlapping before doing the actual check, so I am unsure the result will work out that much with distance, even though a pick nearest before a collision seems to perform better (when it can be used).

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
64 4,528
nimos100's avatar
nimos100
Unread hot topic
44 6,528
TideKitLawsuit's avatar
TideKitLawsuit
Unread hot topic
0 Favourites
[Behavior] Face Detection
35 11,844
Hardmann's avatar
Hardmann