Jump to content

  • Log In with Google      Sign In   
  • Create Account


#ActualAshaman73

Posted 19 September 2012 - 03:24 AM

First off, use integer positions for your chunk to avoid equal-comparisions of floats/doubles.

First approach: own coordination system like rnlf sugguested

int x = (int)(player.x/CHUNK_SIZE_X);
..

Second approach: chunk is referent by real coord
int x=(int)( floor(player.x/CHUNK_SIZE_X)*CHUNK_SIZE_X);

#1Ashaman73

Posted 19 September 2012 - 03:23 AM

First off, use integer positions for your chunk to prevent equal comparision of floats.

First approach: own coordination system like rnlf

int x = (int)(player.x/CHUNK_SIZE_X);
..

Second approach: chunk is referent by real coord
 int x=(int)( floor(player.x/CHUNK_SIZE_X)*CHUNK_SIZE_X);


PARTNERS