If anyone can, please help me. Linear algebra is not my
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
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.
Well, I seem to have found a way to at least combine matrices
using the concat() method. Still, I have to cycle through each
parent matrix from the target sprite to the top level (stage) to
get a universal comparison.