Gdevelop: The cursor\touch is on object event ignore the shape and size of custom hitbox and rotation of object

Created on 24 Nov 2019  ·  4Comments  ·  Source: 4ian/GDevelop

Describe the bug

It seems like if we edit the hitbox of our object to be smaller or a different shape, the “Cursor\Touch is on object” event ignore this and return true even if the cursor is at any point of the original hitbox which is the full size of the image.
It is also seems to ignore rotation of an object and the condition return true at any point of the original rotation.

It is a problem when you have empty, transparent parts and the object is not a square shape and you don’t want the user to trigger certain events while the mouse is over an empty space but only when the mouse is actually over the object.

Forum:
https://forum.gdevelop-app.com/t/bug-the-cursor-touch-is-on-object-event-ignore-the-shape-and-size-of-custom-hitbox-and-rotation-of-object/21561

To Reproduce

Steps to reproduce the behavior:

  1. rotate something
  2. check if mouse is on the object

Other details

GDevelop 5 beta83 Desktop
Windows 10 64bit

🐛 bug

Most helpful comment

Will probably be fixed during these improvements: https://trello.com/c/hjy2d6O2/383-performance-improvements-for-collisions-raycast-distance-tests-with-large-number-of-objects-or-very-large-levels

No timeline though, still quite a lot of work on this.

All 4 comments

Almost the cause as #1298: hitboxes should be used for this condition.
Potentially use the upcoming spatial management to reduce the cost of this condition when dealing with a lot of objects.

Will probably be fixed during these improvements: https://trello.com/c/hjy2d6O2/383-performance-improvements-for-collisions-raycast-distance-tests-with-large-number-of-objects-or-very-large-levels

No timeline though, still quite a lot of work on this.

This is also on shape painter objects. Basic size used is the size from properties 32*32px.
But the best thing to do are pick the polygon path from the instance and use it as hitbox.
Maybe pixiJS have something for do that ?

But the best thing to do are pick the polygon path from the instance and use it as hitbox.

This is a bit unrelated but yeah another possible improvement to generate the hitbox using the shapes of the Shape Painter. But this can also be using lots of CPU work for nothing if not used, and in particular if games are using it to make complex shapes.

An in-between solution would be to generate a hitbox (and AABB, the bounding box) that is using the min and max points of the shapes. This should be configurable to be deactivated if needed I think.

Anyway, for what is in this thread, I hope to have a revamped collision/raycast/hitbox handling with better performance when querying objects soon :)

Was this page helpful?
0 / 5 - 0 ratings