- Home /
Scale cube with mouse position on terrain
Hey guys, I am back with a new question.
I have got a flat terrain.
I have got a Cube-Prefab with the dimensions x=1, y=0.5, z=1.
What I want to achieve:
-The player leftclicks the terrain. The Cube-Prefab gets initiated with one of the corners at the hit.point of the mouse position.
-If the player moves the mouse the Prefab scales in a way, that one corner stays at the original mouse position and the other one follows the present mouse position above the flat terrain. For better understanding I attach an image:
You see that what I want is quite similar to the common drawn rectangle in Rts-Games, but using a prefab in 3-dimensional space on the terrain.
-What it should represent in the game-
I want the player to be able to build rectangular farmland on the terrain and decide its size freely.
Does someone got a hint for me, how you would approche this?
Your answer
Follow this Question
Related Questions
Scale Objects become flat. 1 Answer
Bake mesh scale. 1 Answer
scale in lightmap access possible with Javascript? 1 Answer
Edit multiple assets at the same time? 2 Answers
Scale mesh between two Vectors 1 Answer