On Wed, Jul 30, 2008 at 6:20 PM, Knapp <
magick.crow@xxxxxxxxx> wrote:
>
> That works unless you game is about space and which star out of 30,000 is
> close. Then the idea of finding the distance to everything gets a bit slow.
> To solve this you can take the position and divide by some distance that you
> think of as close in the X,Y,Z. and take the integer quotient. If it is 0
> then the object is is your close box.
>
> 1,1,1
> 5,5,5
> 20,20,20
>
> close is a cube 10,10,10 so you get
> 0,0,0
> 0,0,0
> 2,2,2
>
> the first 2 are close.
>
> You can do this for are large bunch of objects and keep the result so that
> you only need to check small subsets of the whole and it is pre-calculated.
> If only a few are moving it is a quick check to see if they moved to a new
> cell.
Nice, but this algorithm doesn't take object sizes in consideration,