I'm trying to use fairly simple hit testing for collision detection between two objects. I started with Andy's example (http://www.andybeaulieu.com/Default.aspx?tabid=67&EntryID=95). I downloaded the code and it worked. Pixel-accurate hit testing. Then I put a ScaleTransform on the main canvas in Page.xaml, like this:
<Canvas.RenderTransform>
<ScaleTransform ScaleX="2" ScaleY="2" />
</Canvas.RenderTransform>
After putting a scale transform on the main canvas, hit testing for the child UserControls stopped working. Specifically, the rect.Intersect worked, but the Hit Testing (testing for points) did not return any results. If I scaled it down (setting the ScaleX and ScaleY to .5), then the hit testing worked.
I got curious and tried putting the ScaleTransform on the AsteroidBig UserControl. When I did this, the hit testing only worked for the original size of the object, not the new size of the object.
I also tried putting a RotateTransform on the AsteroidBig UserControl. Hit testing seemed to work pretty well in this condition.
Is this a bug in SL2 Beta1, or am I doing something wrong?
Does anyone know a more reliable method for pixel-accurate collision detection in SL2 Beta1?
Steve Nyholm "snyhol"
blog: http://www.AListForEverything.com