UnityEngine.Terrain.SampleHeight C# (CSharp) Method

SampleHeight() public method

Samples the height at the given position defined in world space, relative to the terrain space.

public SampleHeight ( Vector3 worldPosition ) : float
worldPosition Vector3
return float
        public float SampleHeight(Vector3 worldPosition)
        {
            return INTERNAL_CALL_SampleHeight(this, ref worldPosition);
        }

Usage Example

コード例 #1
0
ファイル: Building.cs プロジェクト: ltasler/Hello-Game
	public void StartBuilding(Player player) {
		owner = player;
		isBuilt = true;
		creationProgress = 0;
		spawnPoint = transform.position;
		while(this.GetComponent<Collider>().bounds.Contains (spawnPoint))
			spawnPoint += transform.forward;
		terrain = Terrain.activeTerrain;
		spawnPoint.y = terrain.SampleHeight(spawnPoint) + unit.GetComponent<Renderer>().bounds.size.y;
	}
All Usage Examples Of UnityEngine.Terrain::SampleHeight