ZIM js JavaScript Framework

Canvas Components, Controls and more!

ZIM 4.4 has Faster HitTests! #HTML #Canvas #JavaScript #ZIMjs #CreateJS


ZIM 4.4.0 has launched with an update to its hitTests to greatly improve SPEED.  Pictured above is hitTestCircle() acting on 1000 droids at 60 FPS.  The trick to performance was to add a hitTestBounds() first as a FILTER for all the hitTests that rely on shape-to-point hit tests.

The hitTestCircle(), for example, checks 8 points around the circle by default and the center of the circle against a shape of the droid.  And it does so for each droid so in the past, this would bog.  Our advice was to turn to the MATHEMATICAL hitTestBounds() which does a lightning fast equation to see if rectangles are hitting – but then we lose accuracy.  Well… after a realizing that we don’t need to test any of the points unless the bounds are hitting… we emerged with a WIN/WIN scenario:  just add a hitTestBounds() before we do the hitTestCircle()!  Now we have performance, and then if we are inside the bounds we do a shape test for accuracy.

This technique has been added to hitTestCircle() and hitTestRect().  hitTestReg() and hitTestPoint() now check to see if the point is in the bounds (if there are bounds) and this speeds up the point check too!

If you want to see the ZIM droids in action, watch the MID Level Tutorials on ZIM LEARN.




Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s


This entry was posted on December 8, 2016 by in interactive media, javascript, launch and tagged , , , , , , , .


%d bloggers like this: