When detecting collision between sprites using color alpha component, should I carry out in world space or in view (local) space, which one is more preferred? Any link or suggested book to this kind of topic is highly appreciated.
Thank :)
When detecting collision between sprites using color alpha component, should I carry out in world space or in view (local) space, which one is more preferred? Any link or suggested book to this kind of topic is highly appreciated.
Thank :)
How would the coordinate space you use affect your actual result? I think you should just select whatever is faster.
There are a couple of things to consider here.
If your sprites are very small relative to the size of your world, or if you are doing tricks with fixed point math, you could get inaccurate results by doing the operations in world space. Local space is likely to have much smaller values, granting you more accuracy.
On the other hand, it is likely that both object's world space matrices are either known, or are calculated every frame anyway so that they can be rendered. The major exception is if those objects are culled, in which case I would question your desire to simulate complex physics on those objects. If the world space matrices are available, there is no reason to do an extra matrix multiply to switch one into the local space of the other. Additionally, if multiple collisions happen simultaneously, you will have to transform into local space twice, as opposed to simply doing the calculations in world space.
That being said, It Probably doesn't matter. Sprite collision isn't rocket science. A typical user will NEVER be able to tell the difference in the floating point calculations as long as your values are reasonable, and on modern processors, a handful of multiplies every frame won't make a difference. I am assuming you aren't trying to do a sprite based MMORPG with ragdolls, so really, choose whichever one you like more.