Sdk/GraphicsComponent: Fix bounding volume when using a local matrix

This commit is contained in:
Lynix 2018-04-15 02:30:36 +02:00
parent 69c61ba746
commit d253ec1adc
1 changed files with 2 additions and 1 deletions

View File

@ -277,7 +277,8 @@ namespace Ndk
{
Nz::Boxf localBox = boundingVolume.obb.localBox;
Nz::Vector3f newPos = r.data.localMatrix * localBox.GetPosition();
Nz::Vector3f newLengths = r.data.localMatrix * localBox.GetLengths();
Nz::Vector3f newCorner = r.data.localMatrix * (localBox.GetPosition() + localBox.GetLengths());
Nz::Vector3f newLengths = newCorner - newPos;
boundingVolume.Set(Nz::Boxf(newPos.x, newPos.y, newPos.z, newLengths.x, newLengths.y, newLengths.z));
}