Collision polygons - more points or more shapes better?

0 favourites
  • 7 posts
From the Asset Store
Connect the dots in the correct order and draw happy animals!
  • I'm making a pinball game and the playfield is an irregular shape (like pinball playfields generally are).

    To use a single shape for the playfield it needs around 30 points to define the collision polygon (complete with warnings of reduced performance).

    Is it better to use multiple shapes to create the playfield (each with say, 6 points) or to have all the points on a single shape?

    Thanks

    NB - can the warnings of too many points on a polygon be disabled? I kind of got it after the first extra point, but it repeats itself and each warning has to be dismissed.

  • This post seems a bit silly, you want to disable warnings as you add more and more points? The warnings are there for a reason, don't make it draw a collision polygon with 30 points or your game is going to run like crap. The object should really have fewer than 8 points. In a 2D game having a shape with collision so complex that it requires 30 points seems bizarre.

  • Thanks for the reply — much appreciated; so to answer my original question multiple shapes with more points collectively is preferable to a single large shape with more than the accepted number of points, as far as performance is concerned?

    I'm fine with having a notification pop up when I add the first point past the accepted number, but one notification is enough — by that point I'm aware I've gone over so subsequent notifications are overkill, just a suggestion for UX.

    The extra points are based on the curve of the shape and the ball (in this case) having to travel smoothly around it.

    Thanks again

  • Multiple objects. Preferably multiple instances of the same object, filtered by nearest or by range to reduce the aggregate collision checks per tick.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Yes multiple objects, no warnings here

  • Are you using physics? If you are then box2d has an 8 vertex limit, so the plugin divides up any objects with more than 8 vertices into different fixtures. An object could have many fixtures all sitting next to each other to make the overall shape you want. If you use more than one object then it's likely that you'll use more fixtures than if you had used one object instead (depends how the object's are divided up).

    I'm making a physics plugin that will be able to help you with this. Check it out in the work in progress forum (Box2D+).

  • Thanks for the responses and for clarifying the best approach.

    The question stemmed from a Udemy course I watched where one object was given a *lot* of extra points:

    so on one hand I thought this could be applied to the playfield too, the warnings that popped up made me want a definitive answer from the experts (thanks!)

    Box2D+ looks interesting — I'll definitely check it out

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