Hit test for Sketch objects...

    Apr 09 2008 | 10:27 pm
    I would like to create an interface that has objects (spheres) that I can click on. With screentoworld() I can convert the mouse click point to world coordinates. The question is how can I test to see if my world coordinates are in a drawn object?

    • Apr 10 2008 | 12:11 pm
      Hi Anthony
      Funnily enough I've been revisiting my xy_lcd patches that you were so kind about quite some time ago.
      I've rebuilt the pseudogravity patch using jitter objects and javascript.
      The js includes some routines for hit detection per object, it needs to be updated to use pythagoras theorem to better detect hit inside a circle...
      The attached file might help you get started
      PS I guess you've seen 47jJitterListener.pat in the jitter tutorials.
    • Apr 10 2008 | 3:10 pm
      Thanks Jules, I will take a look at it.
    • Apr 11 2008 | 3:05 pm
      have a look at i_ispace.js in the int.lib source, which does just this
    • Apr 11 2008 | 3:35 pm
      Actually I did look at your source. You are using "jit.gl.render". I am familiar with doing hit detection using jitter. I am using the jsui sketch object. I believe (as far as I know) jsui sketch does not support JitterListener events. Someone please correct me if I am wrong...