Any better ways of polygonning a circle?

  • So I have circles that need to bounce off each other. The problem is, a 10 point polygon isn't very precise for a circle and they end up overlapping a little. I can make more polygon points but C2 threatens me that that if I do that my game may run slower etc.

    So is there any better way of doing it?

  • Im running into the same problem, but for me it says 8 points is the maximum. Im trying to get the player to run around a circular object, but with 8 points it doesnt look too great lol.

  • pirx

    p0tayters

    If you don't have many objects that have more than 8 polygons, you won't have any problems exceeding the 8 point count. I have used more than 20 points with no problem at all. Alternatively, you can break down your complex shape (in your case not so complex, but never the less...) in to smaller ones with fewer polygons and combine them to emulate the high poly shape.

    Have a look at this topic (https://www.scirra.com/forum/viewtopic.php?f=147&t=101552), I had made a capx that uses both methods to illustrate the procedure.

  • eli0s

    Your capx very awesome.

    in the past i tried to make a big rock, so the player can run above it, but after some time i Stopped because the C2 polygon system making the player change from the run and fall animations.

  • A0Nasser thanks!

    That was probably due to adjacent polygons having more than 180 degree angle between them, and the speed of the Player's movement/Rock's rotation making the Player losing contact with the Rock. A workaround that I can think of on top of my head would be to pin a detector object just below the Player in a way that it overlaps with the Rock while the Player walks upon it, and add a condition that states that the falling animation can be played while the detector object is not overlapping with the rock.

    Here is an example

  • Construct 2's collision algorithm will have a high performance overhead if you use lots of collision polygon points. You can use more and if performance is OK then that's fine, but it would probably be faster to make a segment object (like a slice of cake) and have several points down the edge of the curve, then place several instances of those objects at different angles to make a full circle.

  • Thanks, this is exactly what I meant by 'a better way'. I'll go ahead and try it out!

  • eli0s

    WoW this indeed a creative capx.

    Anyone have a problem with the collision overlap need to see this solution.

    Thank's

  • A0Nasser I am glad that you like it and that I was able to help

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • eli0s Ashley Thanks! That helps alot! Im working on a game where everything is literally circles so making them into cake slices will help!

  • Slice them up, add some lemon and enjoy

  • Also, if you are only using circles (maybe could be expanded to more general cases somehow) and need a very precise circle collision, a simple distance comparison could actually do the job I would say:

    a circle of center A and radius 100, and a circle of center B and radius 10:

    They are overlapping if the distances between them is lower or equal than the sum of the two radiuses.

    But I think this could be more demanding at the end (maybe not), so maybe not a great idea on my part.

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