0 Favourites

Custom bounding boxes / collision masks

This forum is currently in read-only mode.
  • I mentioned this in a help thread, thought it wise to move the discussion here. Original link:

    Currently, if you want collisions based on anything other than pixel perfect or full bounding box, you have to create another sprite to do the job and link the two together with an always event.

    I propose two possible solutions to this problem:

    Firstly, the ability to define custom bounding boxes that would be calculated relative to the hotspot. You would need variables for width, height, x-offset and y-offset, which could be added somewhere in the properties panel. For example, if the hotspot was in the centre of a 32*32 sprite, the bounding box could be defined as W:16, H:32, XO:-8, YO: -16, in order to place a tall, thin bounding box in the middle of the sprite.

    Secondly, for more complex collisions, you could offer the ability to define a custom collision mask, editable in the image editor. This could function in the same way as the multiple animations found on a single sprite. If present, this mask would be used for collisions instead of the currently displayed sprite.

    Any thoughts?

  • One thing - an inverse collision mask that would function as some sort of 'tunnel' within the sprite. A simple toggle should set the mask to inverse and back...

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Stumbled upon this article for rotated 2d rectangle collision algorithms:

    http://www.gamedev.net/reference/progra ... Collision/

    The maths blew my heads up, but it all makes sense to me.

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