hitTestBounds?

Hello guys! We are trying to build a game with ZIM. The wireframe looks like this:

With the triangle "cushion" are we supposed to use hitTestbounds to make it work?
Any advice is appreciated! Thanks a bunch in advance:)

yes
or other hittests

Thank you so much:)

hitTestBounds() will test the bounds of the two objects which is usually a rectangle around their shapes - using outline() will show them.

With a circle and triangle, the hitTestBounds will make them seem like they hit too soon - by just a little.

triangle.hitTestCircle(circle) 

will test if the shape of the triangle is hitting points around the circle. That will give you a better hit test. You can specify the number of points around the circle - see the docs at https://zimjs.com/docs.html?item=hitTestCircle

Thanks Dan!

1 Like