public void SetMeshable(Meshable imeshable, Vector3?direction = null) { meshable = imeshable; Vector3 vectu; BoundingBox bbox = null; if (direction.HasValue) { vectu = direction.Value; bbox = meshable.GetBoundingBox(vectu); meshable.bbox = bbox; } else if (meshable.bbox == null) { //Debug.Log("bounding box not found !!!"); vectu = new Vector3(1, 0, 0); bbox = meshable.GetBoundingBox(vectu); meshable.bbox = bbox; } else { //Debug.Log("assigning existing bounding box"); bbox = meshable.bbox; } ConformToBBox(bbox); stale = true; }
public void SetMeshable(Meshable imeshable, Vector3?direction = null) { meshable = imeshable; Vector3 vectu; if (direction.HasValue) { vectu = direction.Value; } else { vectu = new Vector3(1, 0, 0); } BoundingBox bbox = meshable.GetBoundingBox(vectu); transform.position = bbox.vertices[0]; transform.LookAt(bbox.vertices[3]); Size = bbox.size; Mesh mesh = meshable.GetNormalizedMesh(bbox); GetComponent <MeshFilter>().mesh = mesh; print("mesh.verticeCount=" + mesh.vertexCount.ToString()); }
public void SetMeshable(Meshable imeshable, BoundingBox refBbox) { meshable = imeshable; Vector3 vectu; BoundingBox bbox = meshable.GetBoundingBox(refBbox); ConformToBBox(bbox); stale = true; }