Hello, I was wondering if it was possible to the height of an already placed foundation. I also want to know if it would be possible to work out the maximum height at which that foundation can be placed at its current location.
Sorry for the stupid question.
Solved Getting the height (and maximum height) of a foundation?
Discussion in 'Rust Development' started by hennieben, Feb 19, 2016.
-
Calytic Community Admin Community Mod
This is not a stupid question.
Code:public static float GetGroundY(BuildingBlock block) { RaycastHit hitinfo; position = block.transform.position; if (Physics.Raycast(position, new Vector3(0f, -1f, 0f), out hitinfo, 100f, UnityEngine.LayerMask.GetMask(new string[] { "Terrain" }))) { return hitinfo.point.y; } return position.y; }
Code:float currentHeight = GetGroundY(block); float maxHeight = GetGroundY(block) + FoundationHeight