public static void FixBounds(MeshFilter meshFilter, float fixBoundsRadius) { HB hb = HB.Instance; if (hb == null) { return; } Vector3 hbOffset = HBUtils.GetOffset(GetSettings(), fixBoundsRadius); meshFilter.sharedMesh = HBUtils.FixBounds(meshFilter.sharedMesh, meshFilter.transform, hbOffset); }
public static void FixBounds(MeshFilter meshFilter, Vector3 extents) { meshFilter.sharedMesh = HBUtils.FixBounds(meshFilter.sharedMesh, extents); }
public void FixBounds(bool global) { if (MeshFilter == null) { if (SkinnedMesh == null) { Debug.LogError("m_fixBounds.MeshFilter is null. Unable to FixBounds. GameObject " + name); } return; } if (OriginalMesh == null) { if (SkinnedMesh == null) { Debug.LogError("m_fixBounds.OriginalMesh is null. Unable to FixBounds. GameObject " + name); } return; } if (gameObject.isStatic) { FixMesh(global); } else { Mesh fixedMesh; if (OverrideBounds) { fixedMesh = HBUtils.FixBounds(OriginalMesh, Bounds); } else { fixedMesh = HBUtils.FixBounds(OriginalMesh, transform, HBOffset()); } if (IsGlobalSettingOverriden()) { fixedMesh.name = OriginalMesh.name + " HB Local"; SetMesh(fixedMesh, false, true); } else { if (global) { fixedMesh.name = OriginalMesh.name + " HB Global"; IsMeshFixed = false; IsBoundsFixed = true; if (HB.Instance == null) { throw new System.InvalidOperationException("HB.Instance is null"); } HB.Instance.Internal_UpdateMeshInGroup(this, fixedMesh); } else { fixedMesh.name = OriginalMesh.name + " HB Local"; SetMesh(fixedMesh, false, true); } } } }