Parallel cube to terrain

How can we make a cube be 3 height from the terrain and it rotation to be the same as the hills and land,and move around anywhere like it floating over the terrain. C# please

  • Raycast down from the cube until it hits the terrain.
  • Set the transform.position of the cube equal to the hit point position + Vector3.up * 3.0f
  • Set the Euler angles of the transform.rotation of the cube equal to the hit point normal

It’s exactly the same in whatever scripting language you want.