Circle Collision Radius

0 favourites
  • 15 posts
From the Asset Store
Dodge the spikes and collect the gems as you orbit the circle.
  • How do i adjust collision circle radius ? If it's not in yet, a good workflow: Instead of Set Collision Polygon on Sprite Editor change it to Set Collision Body. If it's a polygon set it like it is now. If it's circle mode adjust circle radius by distance between mouse and sprite center. If it's rectangle mode either treat it as a polygon and constrain adjusting to rectangle or treat it as a true rectangle in code. That would be a nice workflow imo.

  • Here is your answer ...

    You need to make a mask ... and position it on the same position as the object and then ..

    (Every Tick) : (Mask) : Set size to (distance(Mouse.X*2, Mouse.Y*2, Circle.ImagePointX(0)*2, Circle.ImagePointY(0)*2),distance(Mouse.X*2, Mouse.Y*2, Circle.ImagePointX(0)*2, Circle.ImagePointY(0)*2))

    I hope it helps !

  • Well you misunderstood :) That won't help at all, maybe for some other case. And it's editing the circle in edit time not runtime but thanks anyway :) And an observation : using dummy sprites for collision stuff is imo really bad. It's at max a temporary workaround. Avoid doing that if possible !

  • Oh , Well I am sorry !

  • The reason we don't have a circle is because, well there's no such thing as a circle. It's either a bunch of points, which is highly unrecommended, or you use pythag IE distance(), which is not a great idea because it does not pick on its own.

    I would suggest thinking less circle, and more poly, as in hexagon, or perhaps octagon.

  • No need pal, the important thing is trying to help :D


    You're closing your thinking in polygons. A circle in this case is just a point and a radius nothing more. It's the fastest and easiest to implement (circle X circle). That's why the ideal is the concept of a collision body made with sub parts. Each part can be a polygon or circle. That introduces substantial complexity yes, having to handle , polygon x polygon , polygon x circle and circle x circle. In the simplest mode. And having to adapt that to physics. That's why very few engines implement this properly.

    Well for now octagons will do...

  • Using a smaller object underneath just for the collision isn't so bad, only one extra object.

  • You could have hundreds :)

  • If you're talking about normal collision checking, like mouse clicks or sprite collisions, then I would check for a circle collision in the code triggered by a square collision. (IE, a square with 10 width would have a 5 radius, whenever the square collides it would then check for a radial collision from the center)

    Although you're right, the image editor having a circle option separated from pixels could be a useful feature. But in terms of game efficiency, there's nothing wrong with resorting to octagons or manually checking its radius on collision.

  • You seem to already have the answer - just check if the distance between the coordinate you want to check and the center of the object is smaller than the circle radius - if it is, there's a collision.

    if you want to check between two circles, the process should be very similar, and extremely simple as well: the distance between the objects should be less than the sum of their respective radii for a collision to happen.

    If you need something else, try this:

    Collision detection and reaction

    it's made for AS3, but one with your knowledge level should be able to port the code easily :)

  • The problem is that it's a physics game entirely made of circle based sprites. That's why i asked. If it were just a simple collision detection of course i code code it myself...

    I'll test to see how things go with fake polygon circles. But adding control to circle body is very important imo. Other thing is adding the rest of joints like MouseJoint and adding Kinematic Control.

  • Sounds like you need to put in a request to have some primitives, other than box in the editor.

    The question is what other primitives would be useful while not taxing the system too much.

    Ashley might say that an octagon would be too much, where something like an iso square would be about the same.

  • For some reasons I did a square invisible player and pinned some objects on him.

    One of them was a circle with Physics behavior, where have that circle collision mask.

    I used the circle to smoothly the detection between the player and some physic boxes on the screen.

    Following this philosophy, you'll be able to reach what you want mixing it with the other types of collisions in your game, and of course, if you change the sprite size, the circle also change.

    A long discussion was made about the circle polygon, on Stencyl community, and the result was No, they didn't implemented it because of the issues around the Hardware usage and performances.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Scofano

    Seems a bit pointless to me making a post in a thread from over 5 years ago.

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