Can you help explain this positioning conundrum to me!
I am getting started with Unity and am just trying to get my head around the units. What are these units? It seems they are their own 'quantity' and to treat 2 units as 2 times the value of 1 unit.
Anyway - I am trying to workout how to optimally calculate transforms to objects sit exactly where I want them to.
In my scene I have a terrain and a cylinder as so:
As you can see my cylinder is floating. I want the cylinder to sit perfectly on top of the terrain.
So.
My terrain is at the following transform: 0,0,0 and scale 0,0,0 (not sure how to tell it's dimensions yet).
My cylinder is part of a new object, as so:
My FirstPersonPlayer is at transform: 85.9,2.165,51.8 and scale 1,1,1. My Cylinder is at 'localposition' 0,0,0 and local scale 1.2,1.8,1.2
Now - the transform of FirstPersonPlayer on the y axis appears to be what I need to correct.
Currently it is set to 2.165 and is floating a bit above the terrain.
Through manually shifting it, around 1.85 looks about right - but I want to know how to calculate that, rather than doing a finger in the air 'that looks about right'.
Can anyone help me? (Before you suggest using gravity etc , I actually am, but don't want the player falling as soon as they start, however slight that may look or feel.
Many thanks,
Answer by TheSituation · Jun 17, 2020 at 08:06 PM
You don't have to compute anything, hold Shift + Control and drag the object. Every game engine ever made calls this "Snap to Ground" -- that is the answer, i got quick answers from StackOverflow - https://stackoverflow.com/questions/62428616/explanation-of-how-to-calculate-transforms-in-unity/62437497#62437497
Your answer
Follow this Question
Related Questions
snap object to gridwise 0 Answers
What's a difference between just Scale and localScale or Position and localPosition? 1 Answer
find whether the spawning space is free or not? 0 Answers
Player Prefs not setting the position at start of the game 0 Answers
i want to find object x position value at run time please help me 0 Answers