SHARE
TWEET

Untitled

a guest May 7th, 2019 306 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     public function Raycast(origin, direction , radius, callback):Dynamic{
  2.         // cube containing origin point
  3.         var x = Math.floor(origin[0]);
  4.         var y = Math.floor(origin[1]);
  5.         var z = Math.floor(origin[2]);
  6.        
  7.         // break out direction vector
  8.         var dx = direction[0];
  9.         var dy = direction[1];
  10.         var dz = direction[2];
  11.  
  12.         //direction to increment x,y,z when stepping
  13.         var stepx = sign(dx);
  14.         var stepy = sign(dy);
  15.         var stepz = sign(dz);
  16.        
  17.         //The initial values depend on the fractional
  18.         // part of the origin.
  19.         var tMaxX = intbound(origin[0],dx);
  20.         var tMaxy = intbound(origin[1],dy);
  21.         var tMaxz = intbound(origin[2],dz);
  22.         // the change in t when taking a step(always positive)
  23.         var tDeltaX = stepx/dx;
  24.         var tDeltaY = stepy/dy;
  25.         var tDeltaz = stepz/dz;
  26.  
  27.         //buffer for face callback
  28.         var face = new Vec3();
  29.  
  30.         //avoid infinite loop
  31.         if (dx == 0 && dy == 0 && dz == 0){
  32.             return ("test");
  33.         }
  34.  
  35.        
  36.  
  37.  
  38.  
  39.     }
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
 
Top