1. Hello, I am trying to find the y position of a foundation (placed within the game) by using Raycasts. However, I get an error:
    Code:
    'ConVar.Physics' does not contain a definition for 'Raycast'
    How can I use Raycasts in my plugin?

    Relevant code:
    Code:
            public static float GetGroundY(BuildingBlock block)
            {
                RaycastHit hitinfo;
                var 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;
            }
    Sorry, if this is a stupid question
     
  2. do you want the position y of the foundation or of the ground at that position?
     
  3. The foundation. I am *Attempting* to create a plugin that enables the user to raise foundations without having to destroy them all
     
  4. So you want to get the ground height or the foundation height position?
     
    Last edited by a moderator: Feb 26, 2016
  5. foundation height position
     
  6. just use foundationEntity.transform.position.y then. No need to use Raycast there.
     
  7. How would I find the maximum height that the foundation can be placed at (at its current position)?
     
    Last edited by a moderator: Feb 20, 2016