The Translate
method of the BBox
struct is used to move the bounding box by a specified vector. This method returns a new BBox
that is the result of translating the original bounding box by the given vector.
The Translate
method of the BBox
struct is used to move the bounding box by a specified vector. This method returns a new BBox
that is the result of translating the original bounding box by the given vector.
To use the Translate
method, you need to provide a Vector3
reference that represents the translation vector. The method will return a new BBox
that has been moved by the specified vector.
Note that the original bounding box remains unchanged, as this method returns a new instance with the applied translation.
// Example of using the Translate method // Create a bounding box BBox originalBox = new BBox(new Vector3(0, 0, 0), new Vector3(1, 1, 1)); // Define a translation vector Vector3 translation = new Vector3(2, 3, 4); // Translate the bounding box BBox translatedBox = originalBox.Translate(ref translation); // Output the new bounding box's minimum and maximum extents Vector3 newMins = translatedBox.Mins; Vector3 newMaxs = translatedBox.Maxs;