Circular collision masks for non-physics objects?

0 favourites
  • 13 posts
From the Asset Store
Is a circular loading screen with code ready to use. No Animation.
  • I recently changed the 'engine' of my game from Physics to platformer.

    However I have been severely disadvantged due to the fact that there are no circular collision masks for non-physics objects, something I think is a must for a rotary competition.

    Would circular collision masks for non-physics objects be possible?

    Thanks, sqiddster

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hackish way : a Circle Sprite, pinned via the Behavior to the object you want to have a circular collision mask. You then check collisions on that Sprite.

  • But if I do that, I still need a computationally expensive collision polygon on the circular sprite!

  • Circular collision is the easiest to implement and cheapest of all. Thought that C2 had it already ...

  • That's good to hear. Hopefully Scirra will implement it soon!

  • Is this feature difficult or impossible to implement? It would be a thoroughly valuable addition to C2 and I hope that Scirra will consider it.

  • I support your petition and must say that I'm also in need of such feature.

    A drop-down in object properties like the physics behavior has, with the options for Collision Polygon, Bounding Box and Circle would be enough. A None option to ignore collision detection would be welcome too.

    In the future I think would be better to add collision primitives through the image editor, but for now I would be happy if I could use circular collision in any way.

  • Since we have such a large amount of feature requests our attitude is typically to implement the minimum necessary and move on to the many other crucial things we need to do, like better supporting mobile. Obviously we could implement circular collisions, but I think there's lots of other stuff that takes priority. I'll add it to the todo list though. When we first added collisions in September there was no physics, no Chrome Web Store, Facebook, PhoneGap or Scirra Arcade output, no Families, and so on... hopefully it's clear to see why we didn't spend ages on one feature when we had so much else to do, and that's still true today.

    Using an eight-point octagon should be a good approximation though - or is there something about that which makes it unsatisfactory?

  • Ashley, thank you for putting this issue under consideration! It is just a large issue for me as I am making a rotary gravity shifting platform game for the contest, and circular planetoids are central to its gameplay. Since the collision objects are so large, an octagonal collision mask does not cut it.

    Hmm, I just came up with an idea... Perhaps I could instead make 'segments' with 3 or 4 points of collision, and they could be rotated around a single point in the editor. I suppose this would be a viable alternative.

    Keep working on the important features! I trust your list of priorities completely ;)

  • For me is because of precision issues that varies depending on the rotation of the object and aggravates through scaling.

    I started using the physics behavior and it's circular collision, but since it lacks the feature to disable collisions in runtime I decided to do my own movement through events. Now the problem is not the inability to disable collisions anymore, but the fact that I can't check for circular collisions.

    In another project is a different situation. I used the physics behavior with circular collision and test for collisions with other objects to apply forces. The problem is that when you use Is Overlapping or On Collision it checks for collision using the sprite's collision polygon, but in the same time the physics behavior is using circular collision to interact with other objects. This difference between the collision models, where the space the object occupies is different than the check space, generate errors and unexpected movement.

    Anyway, just wanted to make you aware of the problems I'm having.

  • A circular collision mask is the same as calculating distance from the center of the object (you can offset this, obviously).

    If a point's distance relative to your object is less than the radius of the "circle mask" (which isn't really a mask, just an imaginary concept), that point is colliding with the object.

    I could probably make a behavior to make objects "collide" with perfect circle masks, but it would be an ugly hack and it would probably be computationally expensive for multiple objects. PM me if you really need this urgently and can't implement it via events.

  • Well, you can also test the distance between objects with events: distance(a.x, a.y, b.x, b.y) < 100

    but I understand that's not very convenient. It's on the todo list, but it gets a bit tricky with things like poly-circle and circle-poly collisions.

  • Well, you can also test the distance between objects with events: distance(a.x, a.y, b.x, b.y) < 100

    but I understand that's not very convenient. It's on the todo list, but it gets a bit tricky with things like poly-circle and circle-poly collisions.

    hence the "ugly hack" part (if I were to make this as a plugin)

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