in game building mechanic

Hi guys

I am creating a a game where you can collect parts and build objects to place on the terrain such as walls and what not and it is first person.
My problem is the object placing when you build the object. I can instantiate the object at the raycast from the centre of the screen but I need some ideas on how I can get a transparent version of the object that sticks to the terrain no matter the angles and height and then when you press the build button it places the object there. Sort of like a starcraft style building mechanic but from the fps view point. Any help would be awesome. Thanks.

To get the transparent version, you need a material with an alpha of 0.5f (also a shader that supports transparency), or however transparent you want it to be.

Then you set the rotation and position of the ghost object like in this answer.

For the building part, you just instantiate it like you do now.