How do I detect the collision of a ring with small gap?

0 favourites
  • 6 posts
From the Asset Store
You think you are fast?! Then let’s see how fast you can control this ring!
  • Hey there,

    I want to make a ring and detect if an object hit the outside of it.

    The ring also has a small opening/gap where a bullet shall fly through and move on the inside of the ring.

    Is the only way to achieve a correct hit detection the polygon tool with many many points or do you guys have some suggestions for me?

    TLDR:

    How can I achieve to hit detect only the ring shape itself?

    Best regards!

  • ..only with ring and half ring

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks for the fast and nice reply even with example!

    I had the same idea so far with a not so well made polygon shape to do the job somehow. But isnt there any other way which is more clean and precise?

  • You could do your own collision detection with some math if you want it to be very precise.

    In the attached capx it does point vs ring with gap collision detection.

    The idea is you can find if a point overlaps the ring if the distance from the point to the center of the ring is between the inner and outer radius' and if the angle from the center of the ring to the point is not within half the angle width of the gap from the current angle of the gap.

    Like most math like this it makes more sense if you draw a diagram of it.

  • Dear R0J0hound,

    this is absolute amazing!

    This is absolutely what I was trying to get but couldnt achieve!

    I am so thankful!

    I tested it and it looks awesome, cant figure out your few lines of math which do the magic but i get into it.

    Thanks again!

  • Solano

    Here's the capx I used to make the ring image. It uses the Canvas Plugin.

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