public void ApplyCluster(VoxelCluster voxelCluster) { isStatic = isOriginal ? true : voxelCluster.ShouldBeStatic(isStatic); Vector3 GetLocalPosWithWorldRotation(Vector3 localPos, Transform t) { return(t.TransformPoint(localPos) - t.position); } Vector3 pivot = GetPivot(voxelCluster.Bins, voxelCluster.Dimensions, isStatic); //meshTransform.position += GetLocalPosWithWorldRotation(voxelCluster.VoxelOffset, meshTransform); //meshTransform.parent = null; //transform.position = meshTransform.position + GetLocalPosWithWorldRotation(pivot, meshTransform); //meshTransform.parent = transform; meshTransform.position += GetLocalPosWithWorldRotation(voxelCluster.VoxelOffset, meshTransform); Vector3 cachedMeshTransformPos = meshTransform.position; transform.position = meshTransform.position + GetLocalPosWithWorldRotation(pivot, meshTransform); meshTransform.position = cachedMeshTransformPos; binGridDimensions = voxelCluster.Dimensions; bins = voxelCluster.Bins; voxelBuilder.Refresh(); }