What is the difference between a Bounding Box and a Rectangle?
This question is specifically about Unity 3D's Bounds and Rect classes, but I am moreso interested in a general answer.
Specifically:
Which is better on performance?
Irrelevant. They are the same in 2D, and in 3D they have different meaning/use.
Is a Bounding Box just a 3D Rectangle?
There is no such thing as a 3D rectangle. You mean a box. A bounding box is a box that's just large enough to encompass all collidable parts of an entity/model.
When should I prefer one over the other?
Irrelevant, see first paragraph.
Are they interchangeable terms, and if so, why does Unity 3D have separate classes for them?
Again, 2D vs 3D.
Any other knowledge you can bestow would be greatly appreciated!
Bounding boxes exist to improve performance of collision detection. If two body's bounding boxes do not intersect, there is no need to further process any of their colliders or in 2D performing a pixel-perfect intersection test. Bounding boxes allow the collision detection algorithm to quickly discard any guaranteed non-colliding bodies.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With