it turns green only in the centre and red around the corners …
if ((point - building.transform.position).sqrMagnitude <= buildingRangeLimit * buildingRangeLimit)
i tried reversing this line by changing the <= to >= and the opposite happened that is I could place buildings around the corner but not in the centre …and no its not coolider issue since I only one collider ob the main building …
public bool CanPlaceBuilding(BoxCollider buildingCollider, Vector3 point)
{
if (Physics.CheckBox(
point + buildingCollider.center,
buildingCollider.size / 2,
Quaternion.identity,
buildingBlockLayer))
{
return false;
}
foreach (Buildings building in buildings)
{
if ((point - building.transform.position).sqrMagnitude
<= buildingRangeLimit * buildingRangeLimit)
{
return true;
}
}
return false;
}
here is the code