Sdk/GraphicsComponent: Fix bounding volume when using a local matrix
This commit is contained in:
parent
69c61ba746
commit
d253ec1adc
|
|
@ -277,7 +277,8 @@ namespace Ndk
|
||||||
{
|
{
|
||||||
Nz::Boxf localBox = boundingVolume.obb.localBox;
|
Nz::Boxf localBox = boundingVolume.obb.localBox;
|
||||||
Nz::Vector3f newPos = r.data.localMatrix * localBox.GetPosition();
|
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));
|
boundingVolume.Set(Nz::Boxf(newPos.x, newPos.y, newPos.z, newLengths.x, newLengths.y, newLengths.z));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue