Convert Vector2 to Vector3 based on the ground's height?

How do I get the point the ground is leveled at a vector2 position?

This question is a bit strange. How you will accomplish the task will depend 1) on the orientation of your geometry, and 2) on the nature of your geometry. If you are talking about and XZ coordinate in which you want the ‘Y’. Then:

  • If your ground is a Terrain, you can use Terrain.SampleHeight().
  • If your ground is some other collider, then you use a Raycast(). If you only want to check a single collider that you want to use for the ground, use Collider.Raycast(). If you want to check any objects in the scene, use Physics.Raycast(). You will pick a ‘y’ height guaranteed to be above your ground and use Vector3.down for the direction.