mirror of
https://github.com/drewcassidy/KSP-Conformal-Decals.git
synced 2024-09-01 18:23:54 +00:00
OrientedBounds cleanup
This commit is contained in:
parent
b72fcb07f0
commit
1f92797072
@ -58,9 +58,10 @@ namespace ConformalDecals {
|
|||||||
Vector3 unitZ = matrix.GetColumn(2);
|
Vector3 unitZ = matrix.GetColumn(2);
|
||||||
var scale = new Vector3(unitX.magnitude, unitY.magnitude, unitZ.magnitude);
|
var scale = new Vector3(unitX.magnitude, unitY.magnitude, unitZ.magnitude);
|
||||||
|
|
||||||
_localBounds = new Bounds();
|
_localBounds = new Bounds {
|
||||||
_localBounds.center = matrix.MultiplyPoint3x4(aabb.center);
|
center = matrix.MultiplyPoint3x4(aabb.center),
|
||||||
_localBounds.extents = new Vector3(aabb.extents.x / scale.x, aabb.extents.y / scale.y, aabb.extents.z / scale.z);
|
extents = new Vector3(aabb.extents.x / scale.x, aabb.extents.y / scale.y, aabb.extents.z / scale.z)
|
||||||
|
};
|
||||||
|
|
||||||
OrientationMatrix = Matrix4x4.zero;
|
OrientationMatrix = Matrix4x4.zero;
|
||||||
UnitX = unitX / scale.x;
|
UnitX = unitX / scale.x;
|
||||||
@ -95,7 +96,7 @@ namespace ConformalDecals {
|
|||||||
// compute translation vector t in our coordinate frame
|
// compute translation vector t in our coordinate frame
|
||||||
var t = R.MultiplyVector(other.center - Center);
|
var t = R.MultiplyVector(other.center - Center);
|
||||||
|
|
||||||
return IntersectOBBSeperatingAxis(R, t, Extents, other.extents);
|
return IntersectOBBSeperatingAxis(R, t, Extents, other.extents);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool IntersectOBBSeperatingAxis(Matrix4x4 R, Vector3 t, Vector3 a, Vector3 b) {
|
private static bool IntersectOBBSeperatingAxis(Matrix4x4 R, Vector3 t, Vector3 a, Vector3 b) {
|
||||||
|
Loading…
Reference in New Issue
Block a user