I mean what is better for performance using the object.hitTestObject or calculate the bounds like:
if(obj.x > obj2.x && obj.x < obj2.x + obj2.width &&
obj.y > obj2.y && obj.y < obj2.y + obj2.height)
{
trace('spaceship damaged!!!');
}
//or using
if(obj.hitTestObject(obj2))
{
trace('spaceship damaged by hitTestObject!!!');
}
what do you use in practice more? and what is more efficient? how much percent performance gives the self calculation? 20%? 40%? 60%?
This article gives you a good insight concerning your question
http://www.mikechambers.com/blog/2009/06/26/relative-performance-for-collision-detection-techniques-in-actionscript-3/
HitTest seems to be the fastest, which seems reasonable as I’d reckon Adobe’s API would be optimized for the best performance possible.
[edit] as for SO answering, bitmapdata.com seems to be slightly faster than Will Kru.