public static bool Intersect(CylinderTriggerBounds a, CylinderTriggerBounds b, out float sqrDistance) { var cylaOffset = a.offsetCenter; var cylbOffset = b.offsetCenter; sqrDistance = Vector3Extender.SqrMagnitudeXZ(cylaOffset - cylbOffset); // XZ check var heightDistance = Mathf.Abs(cylbOffset.y - cylaOffset.y); // Y check var radius = a.scaledRadius + b.scaledRadius; var height = a.scaledHeight + b.scaledHeight; return((sqrDistance < radius * radius) && (heightDistance < height)); }
public override bool Intersect(CylinderTriggerBounds bounds, out float sqrDistance) => BoundCollider.Intersect(this, bounds, out sqrDistance);
public virtual bool Intersect(CylinderTriggerBounds bounds, out float sqrDistance) { sqrDistance = float.MaxValue; return(false); }