1

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:

enter image description here

As you can see my cylinder is floating. I want the cylinder to sit perfectly on top of the terrain.

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:

enter image description here

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'.

(I am already using gravity etc, but don't want the player falling as soon as they start, however slight that may look or feel).

7
  • where is your terrain placed?
    – derHugo
    Jun 17, 2020 at 12:10
  • 1
    You don't have to compute anything, hold Shift + Control and drag the object. Every game engine ever made calls this "Snap to Ground". Jun 17, 2020 at 12:17
  • 1
    @RenegadeAndy No, every object is independent of any other outside of their hierarchy. And generally you wouldn't need one, if you are thinking about writing a validation script to check if all entities are snapped - you probably don't need that. Objects are usually placed once and snapped then only moved in the XZ plane. Jun 17, 2020 at 12:49
  • 1
    I had this same question when I started using Unity (never used a game engine before) and I was missing this snap option so much, comming frod 3D/cad programs, but that its the way it works. I understand that you are not composing an object geometry or shape or whatever, but snap, and grid discrete movement of components in the scene as in Unreal would be so useful to define easily and with precision the disposition of your objects in the scene. In my opinion this is a missing feature in Unity. Jun 17, 2020 at 13:58
  • 1
    Sounds like actually somehow your player should be positioned on 0,0,0 as well and from there on set local positions that are relative to the player object ... its always hard to say without having the project in front of us ...
    – derHugo
    Jun 17, 2020 at 15:25

1 Answer 1

0

As per @Nikola Dimitroff the answer is:

You don't have to compute anything, hold Shift + Control and drag the object. Every game engine ever made calls this "Snap to Ground"

I appreciate and agree with the other comments.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.