Cleaning up.
This commit is contained in:
parent
08201160b1
commit
35b8b986db
15 changed files with 127 additions and 109 deletions
|
|
@ -248,6 +248,15 @@ extend Class SWWMUtility
|
|||
return -atan2(diff.z,diff.xy.length());
|
||||
}
|
||||
|
||||
// box intersection check, for collision detection
|
||||
static bool BoxIntersect( Actor a, Actor b, Vector3 ofs = (0,0,0), int pad = 0 )
|
||||
{
|
||||
Vector3 diff = level.Vec3Diff(level.Vec3Offset(a.pos,ofs),b.pos);
|
||||
if ( (abs(diff.x) > (a.radius+b.radius+pad)) || (abs(diff.y) > (a.radius+b.radius+pad)) ) return false;
|
||||
if ( (diff.z > a.height+pad) || (diff.z < -(b.height+pad)) ) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
// extruded box intersection check, useful when checking things that might be hit along a path
|
||||
static bool ExtrudeIntersect( Actor a, Actor b, Vector3 range, int steps, int pad = 0 )
|
||||
{
|
||||
|
|
@ -261,15 +270,6 @@ extend Class SWWMUtility
|
|||
return false;
|
||||
}
|
||||
|
||||
// box intersection check, for collision detection
|
||||
static bool BoxIntersect( Actor a, Actor b, Vector3 ofs = (0,0,0), int pad = 0 )
|
||||
{
|
||||
Vector3 diff = level.Vec3Diff(level.Vec3Offset(a.pos,ofs),b.pos);
|
||||
if ( (abs(diff.x) > (a.radius+b.radius+pad)) || (abs(diff.y) > (a.radius+b.radius+pad)) ) return false;
|
||||
if ( (diff.z > a.height+pad) || (diff.z < -(b.height+pad)) ) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
// sphere intersection check, useful for proximity detection
|
||||
static bool SphereIntersect( Actor a, Vector3 p, double radius )
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue