Calculating the bounding box of a given model and/or ParticleEmitter

For a project of mine I had to calculate the bounding box of a given model, but not just for the parts inside of it, but also any ParticleEmitters. After a quick perusal I realized there was no released code to achieve this, and so after two days, I got this working instead. I’m open-sourcing this in case someone else needs this as well!

The third parameter, Gizmo, is for my own debugging library that I used to debug this, and can be ignored.


Limitations

It does not take into account for the different EmitterShape properties such as .Shape, .ShapeInOut, and .ShapeStyle. I don’t want to spend more time on this than needed, and so if anyone else wants to implement it, feel free.

I didn’t test this out extensively, however it works fine on the following properties I tested it with:

  • SpreadAngle
  • Acceleration
  • Speed
  • EmissionDirection
  • Animated/different Size values
  • Drag (not fully correct, it seems to be off by some small values)
9 Likes