Whitespace in images counts as part of the hitbox |
Fewfre « Citoyen » 1528215240000
| 1 | ||
In game if you try to click a vending machine, the one next to it can cover it due to the hitbox being based on the image's dimensions, and thus white space being included. This could be solved by have an array of points and defining a custom hit shape Small example (code) In that example, each image only uses an array of 6 points, yet clicking them is much more natural! While it does require a bit more calculation, the math to determine if it contains the point is not that intensive, and can be avoid somewhat by only checking it after checking if it collides under the current system. The only real issues with this that I can see is that someone would need to update every interactable item with an array of points that define the hitbox. However if asked, I'm sure the community would be willing to help with the task if you share the list of images that need it and what you need the array of points relative to (the center, top left, some custom point, etc) Dernière modification le 1528228560000 |