hit test

Hit Test Grid Values (Composition by gtoledo3)

Author: gtoledo3
License: Creative Commons Attribution-ShareAlike
Date: 2013.09.07
Compatibility: 10.6, 10.7, 10.8
Required plugins:

This is a composition I made, that came out of some discussion on the QuartzComposer forum on Facebook, that I thought was kind of cool.

It sets up a grid of values, and as you tap on the different values, you'll be able to retrieve what the last value was.

Javascript Increment Index on event

Swiftlikeninja's picture

I am trying to figure out a way to increment an index of an array based on an event (such as left mouse click over a hit area). The code below sets everything to zero and briefly changes the appropriate index to 1 while the mouse is clicked but changes back to 0 once the mouse is released. What I want to happen is each time the index value is incremented then it stores its current value instead of switching to 0. By the end the array should be mixed numbers. Can anyone provide and assistance?

function (__structure out) main (__structure Pos, __boolean Left,__number X,__number Y,__number W,__number H,__number ShiftX,__number ShiftY)
   if (!_testMode) {
   len = Pos.length;
   Hits = new Array()
   for (i=0;i<len;i++){
      Hits[i] = 0
   for (j=0;j<len;j++){
      if (Pos[j][1] >= (X-(W/2)) && Pos[j][1] <= (X +(W/2)) && Pos[j][0] >= (Y-(H/2)) && Pos[j][0] <= (Y +(H/2)) && Left){ 
   result=new Object();
   return result;



The Kineme2D plugin provides support for drawing vector graphics in Quartz Composer.

  • Create and combine lines, curves, text, and more.
  • Hit-test against vector graphics.
  • Morph, add noise, flatten.
  • Triangulate, extrude, lathe.
  • Import SVG files.

For documentation on 2D drawing concepts used in Kineme2D, see the Quartz guide.

Download the 7-day trial below, or buy a license now.

Unsupported on OS X Mountain Lion (10.8) and above

Please download the trial and make sure it meets your needs before purchasing. Due to bugs in Apple's Quartz Composer framework, we cannot guarantee that Kineme plugins will work properly on Mac OS 10.8 and above. Our focus has shifted to developing Vuo.

Polyspin (Composition by gtoledo3)

Author: gtoledo3
License: (unknown)
Date: 2010.10.09
Compatibility: 10.4, 10.5, 10.6
Required plugins:

This is a composition that:

-Constructs a grid of colored objects, with different controls for color generation.

-Monitors mouse x/y and allows an object to push/pop in Z, and/or spin in x/y or z rotation if the mouse hovers over an object.

-Configures a color crossfade on the object as it returns back to the "home" position of the color grid.

-Controls for force and decay of the hit effect.

-Configurable columns and rows that adjust to the rendering destination.

...and that's the gist of it.

I'm sharing this composition to show a way of using an iterator that will make one or more object parameters change after they are triggered.

I used a modified version of this for this video post:

Tossing A Frisbee

dust's picture

so i posted a vertex hit tester a few days ago. it was my intent to build something like this game i'm building in unity 3d for the iPad...


....in qc and the vertex hit tester was my first step. i think all the components are in qc all ready like forces, mouse, track ball etc...

so i decided on going with a frisbee golf type of game instead of a tower defense sort of thing.

was wondering if i could get any feedback as to how intuitive steering the disc is etc...

the first shot is a mid range.... you need to steer the disc into diamond inside the basket to load a new level.....

the second basket is a long range shot...

both shots are make-able....

you aim the disc with your mouse xy and can pump the disc up for extra loft until gravity brings you down.

there are a few basic components. power, hook, range, and loft. all of which are derived from quaternion rotational attributes of the frisbee object.

eventually i will get around to designing 18 levels with a regular golf type of logic. right now its just a hole in one challenge until i get the physics worked out.