Topic: replace building mesh with a new one
Hi,
I am working on the function to replace the building meshes with a kind of 'debris' meshes (created in Blender).
I made function to detect small buildings:
//in Start
buildingsControl.OnShowBuilding = OnShowBuilding;
private bool OnShowBuilding(OnlineMapsBuildingBase onlineMapsBuildingBase)
{
var gMesh = debris1.GetComponent<MeshFilter>();
var mesh = onlineMapsBuildingBase.GetComponent<MeshFilter>();
//detect building volume
var size = VolumeOfMesh(mesh.mesh);
if (size < 200000)
{
//replace (bad way)
mesh.mesh = gMesh.sharedMesh;
}
return true;
}I get an expected result. But the new mesh is not of the previous building size and scale (apparently it is of its initial prefab size).
Could you please sugest a better way or idea to do this?