SHARE
TWEET

Untitled

a guest Sep 21st, 2014 192 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     public void checkCollision()
  2.     {
  3.         camera.update();
  4.         shapeRenderer.setProjectionMatrix(cameraGUI.combined);
  5.         shapeRenderer.begin(ShapeRenderer.ShapeType.Line);
  6.         shapeRenderer.setColor(1, 1, 0, 1);
  7.         for(GameObject object : objects)
  8.         {
  9.             if(object instanceof DynamicObject)
  10.             {
  11.                 SpatialHashGrid.instance.removeObject(object); //removes 1 object at a time
  12.                 object.update();
  13.                 SpatialHashGrid.instance.insertDynamicObject(object);
  14.                 colliders = SpatialHashGrid.instance.getPotentialColliders(object);
  15.  
  16.                 for(GameObject collider : colliders)
  17.                 {
  18.  
  19.                     shapeRenderer.rect(100,100,100,100);
  20.  
  21.                     if(object.checkCollision(collider))
  22.                         object.collided(collider);
  23.                 }
  24.             }
  25.         }
  26.         shapeRenderer.end();
  27.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top