protected void Init(UltimateTerrain uTerrain) { converter = uTerrain.Converter; Vector3d min, max; min.x = corner.x; max.x = min.x; if (vL.x < 0) { min.x += vL.x; } else { max.x += vL.x; } if (vH.x < 0) { min.x += vH.x; } else { max.x += vH.x; } if (vW.x < 0) { min.x += vW.x; } else { max.x += vW.x; } min.y = corner.y; max.y = min.y; if (vL.y < 0) { min.y += vL.y; } else { max.y += vL.y; } if (vH.y < 0) { min.y += vH.y; } else { max.y += vH.y; } if (vW.y < 0) { min.y += vW.y; } else { max.y += vW.y; } min.z = corner.z; max.z = min.z; if (vL.z < 0) { min.z += vL.z; } else { max.z += vL.z; } if (vH.z < 0) { min.z += vH.z; } else { max.z += vH.z; } if (vW.z < 0) { min.z += vW.z; } else { max.z += vW.z; } from = new Vector3i(min) - Vector3i.one; to = new Vector3i(max) + Vector3i.one; oppositeCorner = corner + vL + vH + vW; nLH = Vector3d.Cross(vL, vH).Normalized; nLH *= Math.Sign(UMath.DistanceToPlane(oppositeCorner, corner, nLH)); nHW = Vector3d.Cross(vH, vW).Normalized; nHW *= Math.Sign(UMath.DistanceToPlane(oppositeCorner, corner, nHW)); nWL = Vector3d.Cross(vW, vL).Normalized; nWL *= Math.Sign(UMath.DistanceToPlane(oppositeCorner, corner, nWL)); halfExtents = new Vector3d(vW.Magnitude, vH.Magnitude, vL.Magnitude) * 0.5; }