SHARE
TWEET

Untitled

a guest Oct 12th, 2015 75 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public class ClosestRayResultCallback extends RayResultCallback implements Pool.Poolable {
  2.  
  3.     public RayResultCallbackData result;
  4.  
  5.     @Override
  6.     public float addSingleResult(LocalRayResult rayResult, boolean normalInWorldSpace) {
  7.         result = Pools.obtain(RayResultCallbackData.class);
  8.  
  9.         result.btCollisionObject = rayResult.getCollisionObject();
  10.         result.hitFraction = rayResult.getHitFraction();
  11.         result.hitNormalLocal = rayResult.getHitNormalLocal();
  12.         result.localShapeInfo = rayResult.getLocalShapeInfo();
  13.         result.normalInWorldSpace = normalInWorldSpace;
  14.  
  15.         return rayResult.getHitFraction();
  16.     }
  17.  
  18.     @Override
  19.     public void reset() {
  20.         Pools.free(result);
  21.         result = null;
  22.     }
  23. }
  24.  
  25.  
  26. public class RayResultCallbackData implements Pool.Poolable {
  27.  
  28.     public btCollisionObject btCollisionObject;
  29.     public float hitFraction;
  30.     public btVector3 hitNormalLocal;
  31.     public LocalShapeInfo localShapeInfo;
  32.     public boolean normalInWorldSpace;
  33.  
  34.     @Override
  35.     public void reset() {
  36.         btCollisionObject = null;
  37.         hitFraction = 0f;
  38.         hitNormalLocal = null;
  39.         localShapeInfo = null;
  40.         normalInWorldSpace = false;
  41.     }
  42. }
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