1 Reply Latest reply on Aug 10, 2006 2:28 AM by jpwrunyan

    Is there a way to combine matrix data?

    jpwrunyan Level 1
      If anyone can, please help me. Linear algebra is not my specialty.

      I am trying to make a function using the BitmapData.hitTest() to see if two sprites on screen are hit.
      I have got it working for sprites that are direct siblings (ie they are on the root stage layer). However, if I nest sprites, things get messy. The reason I want to test nested objects is so I can test for collision with *parts* of other visual components, not the whole thing as one.

      I can get a proper tx, ty value for nested sprites by using the localToGlobal functions, but these do not take into consideration rotation. Is there something like localToGlobal that works for an object's entire transform matrix (and if not, why not?!)?

      Does anyone have any advice?

      The only thing I can think of is to go through a given sprite's parents until it reaches the top (root) layer and collect the matrix data on the way. But even if I do that, I don't know how to add the matrices together properly. I am convinced I need to do this. If I don't use the actual transform matrix, I cannot take into account skewing, rotation, etc.