Page 1 of 1

2D Rect Collision

Posted: Sat Mar 08, 2008 3:43 pm
by MacGyver
Hello
@ first yes i use the search function but the awnser was like this.
http://irrlicht.sourceforge.net/phpBB2/ ... ctcollided

The problem is, i have one Sprite and i only have to check the collision of this
Sprite with all others.

In the Link is the way to check each Sprite with each other Sprite.
Give it a better way ?

sorry for my bad english.

Greats MacGyver

Posted: Sat Mar 08, 2008 6:26 pm
by vitek
Maintain a collection of the 'other' sprites. Check the 'main' sprite for collision against every sprite in that collection. That is O(n).

If it is to slow, then do something to limit the number of items in the 'other' sprite list to test against, or order them so that you don't need to do as many comparisons.

Travis