Precise Mask (instead of Collision Box) ?

0 favourites
  • 8 posts
From the Asset Store
Particles support animations, collisions, effects and etc.
  • Hi All,

    In my project I have many different objects with very complex shapes (not just box, circle, simple shape).

    I'm using the: "Mouse Cursor Over" to pick each object on the layout and tweak them,

    Once there are MANY objects it is very helpful that the mouse cursor touching the VERY EDGE of each complicated shape.

    I must draw a very close Collision Polygon for the Mouse Cursor to recognize it from it's complex shape edges, since a Circle / Box / 10 Points Polygon Shape won't do the job it won't select the objects behind very well (I tried it so many times).

    .

    My Questions:

    Is there a way to tell the Mouse Cursor to recognize the object based on their actual Pixel Shape? and NOT based on their Collision Polygon shapes?

    How can I make the Mouse Cursor to recognize the objects based on their Precise shape instead of the collision Polygon shapes?

    BTW - I'm not using COLLISION on my shapes (they are disable) all I need is 100% Precise shape for the mouse cursor to recognize when I pick each shape.

    .

    I hope there is a precise shape option in C3 since drawing collision shape for each shape (and I have lots of them) is a very time consuming and also not 100% precise anyway, Again I don't need to collision itself but a 100% MASK shape for selection.

    If there is a solution that is hidden from my eyes, please let me know, thanks ahead! :)

    Tagged:

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It's not supported because it's an incredibly complicated feature, likely has worse performance than collision masks, and I've not seen any convincing cases where it really is necessary. In particular mouse input is not really that precise - most users move the mouse to an approximate area, not a specific pixel, because mouse control is fairly inaccurate. That's why large buttons are easier to click on. Therefore there's no point having a super-accurate collision mask for clicks, because mouse input is not that precise. In fact usually the click area is simplified and enlarged to make it easier to click on.

  • Thanks for the quick reply Ashley I see, it make sense but unfortunately on my project it is needed that's why I asked for this.

    I guess I will have to draw manually all my shapes one by one, it will take lots of time and whenever I'll update or change I will have to do it again but it's better than nothing.

    So If I'll use more than 20-40 points for the Mouse Cursor to recognize the shapes on the very edge (as this is what I need in my case), Consider the collision are Disable (I don't need them)

    The question is:

    Will many shapes on the screen, each one with multiple polygon shapes (20-40 points) make things slower? or not necessarily because it's not calculating collision but only use as precise mask?

    If I have no choice and it won't slow-down (please consider also OLDER machines not just modern in your answer) I guess I can just draw them manually one by one...

    unless it is slowing down things, I'll have to find another solution.

    Imagine Over 200-400 or even much more objects on the screen, each with very complex multiple points for their collision polygon... (all collisions are disabled, using as mouse cursor / mask only)

  • You can try reading pixel data with DrawingCanvas. Put a small DrawingCanvas object under the mouse cursor, paste your sprites onto it starting from the top (on z-axis), save snapshot, read the pixel. Repeat for all overlapping sprites, until the pixel has some color information. Not sure if you can process multiple sprites like this in one tick though.

  • Will many shapes on the screen, each one with multiple polygon shapes (20-40 points) make things slower?

    Answer your own performance questions with measurements

  • > Will many shapes on the screen, each one with multiple polygon shapes (20-40 points) make things slower?

    Answer your own performance questions with measurements

    I probably didn't make myself clear with my question:

    Instead of just test it on my own machine (where I create my project on), I cannot test it on multiple different machines and know the results.

    So my question is more general: Will the collision shape with multiple points SLOW-DOWN everything EVEN if the collision itself are disabled on all objects.

    The ONLY reason I use them is for more precise mask for selecting via the mouse cursor.

    I hope that my question is more clear now, sorry about my bad English and thanks ahead!

  • Will the collision shape with multiple points SLOW-DOWN everything EVEN if the collision itself are disabled on all objects.

    No. If you don't make collision checks, the collision mask is not used at all.

  • > Will the collision shape with multiple points SLOW-DOWN everything EVEN if the collision itself are disabled on all objects.

    No. If you don't make collision checks, the collision mask is not used at all.

    True, the objects won't use the mask (polygon shapes) for collision, But the mask used for the Mouse Cursor to recognize each one consider there are a lot of them on the screen at the same time, so I hope it won't use lots of calculating power and slowing down things while moving with the mouse around so many objects on the screen on different machines (modern and older) since I obviously can't test all by myself.

    Mouse cursor moving around over so many object to recognize each one it touches it's mask (polygon shapes with 20-40 points each) I guess it won't be heavy as calculating collisions, but I really hope it won't slow down everything as well... I have no idea how it will work on older machines.

    I hope it won't be a heavy CPU use / calculation.

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