The type parameter for setCollider() can be “rectangle” or “circle”. Is there a way to set the collider area as another shape for sprite with a more irregular outline?
Unfortunately, no. You could try using multiple sprites and having them all together in a group, but that’s about it.
1 Like
When we deal with irregular shapes, there are not easy formulas that we can employ that will show whether or not two objects are overlapping. There is a computational ease to using ellipses or rectangles to calculate collisions. Using invisible “hit boxes”-- usually rectangles or ellipses-- has been a common practice since the earliest days of the video game industry.
This is somewhat akin to the comparison between analog and digital states. Digital is discrete and is an approximation, but oftentimes the approximation is good enough that most people cannot tell the difference
Thanks for writing in!
Erik
3 Likes