internal static BoundingBox MakeAabbFromSpotlightCone(ref MySpotlightInfo spotlight, Vector3 position) { float ratio = (float)Math.Sqrt(1 - spotlight.ApertureCos * spotlight.ApertureCos) / spotlight.ApertureCos; float h = ratio * spotlight.Range; var bb = BoundingBox.CreateInvalid(); bb.Include(new Vector3(-h, -h, 0)); bb.Include(new Vector3(h, h, -spotlight.Range)); return(bb.Transform(Matrix.CreateLookAtInv(position, position + spotlight.Direction, spotlight.Up))); }