• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by cj31387 · May 29, 2015 at 07:37 AM · editorsnap

Editor Snap to floor?

Is there a hotkey like unreal to snap a gameobject in the scene to something below it like unreals end key? I know this somewhat partially exists because when you drag a prefab from the asset folder out into the viewport and continue to hold the mouse button down it will snap to what ever you are mousing over. But is there a key to do this when a object is already in the editor hierarchy?

I want it to work like it does when you drag a new asset out like this (but for existing assets in the editor). The vertex snapping is kind of too complex especially when its a high vertex model.

https://dl.dropboxusercontent.com/u/94084288/ShareX/2015/05/2015-05-29_00-47-54.mp4

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Gruffy · Apr 16, 2018 at 02:54 PM 0
Share

Personally, with the advent of Pro tools like "Pro Grids", Unity's snapping reminds me of a famous Back to the future II quote :

Roads? Where we're going, we don't need roads.

Unity snapping has always been there, but grab Pro Grids and see the difference altogether, Unity bought it so we could use it for free and because it was better than anything currently available in the engine for object placement and snapping.

(Pro Grids ftw honestly) :)

2 Replies

· Add your reply
  • Sort: 
avatar image
2
Best Answer

Answer by ninjapretzel · May 29, 2015 at 07:40 AM

There is 'vertex snapping' on the v-key when using the Translate or Rect tools.

Select the object you want to move.

Press V

Hover over the vertex you want to snap

Click and drag it to the vertex you want to move it to

Unity will move the object so the two vertices are touching.

(Edit: Who thought it was a good idea to have lines that are together merge?)

Comment
Add comment · Show 4 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image cj31387 · May 29, 2015 at 07:44 AM 0
Share

Is there also a key for doing it based off pivot or something, It can be kind of hard when its a high vertex mesh to get the bottom of something

avatar image ninjapretzel · May 29, 2015 at 08:13 AM 1
Share

I don't know, but when you drag a prefab from the project window onto a solid, it does place the object at the origin. The only thing is you can't do the same when the object already exists in the scene.

It's also possible to script something that makes the object move onto the ground- put the content of this pastebin in a script in a folder named "Editor". http://pastebin.com/2vrUVf5E

It will add a menu option in the top menu that you can use to move an object's pivot into the ground. If Unity doesn't provide a solution for something, it's pretty easy to extend the editor and add the feature with a little script like that.

avatar image burtonposey ninjapretzel · May 02, 2016 at 10:17 PM 0
Share

Thanks for posting this! I improved this a tad to be more like Unreal.

Shortcut is now Shift+END and the script now looks in the select object for a $$anonymous$$eshRenderer (first one it finds as written) and it checks the renderer's bound.extents and compares the resulting position from the center to the extent with the selected objects y position. This ensures that if a transform has a pivot at the bottom of the object, the script doesn't blindly assume a center pivot.

http://pastebin.com/QGTCqD6T

avatar image DiegoDePalacio burtonposey · Nov 10, 2017 at 01:20 AM 0
Share

Thank you for your help!

The last version of the script can be improved in order to also be able to snap objects in where the pivot point is outside of the mesh renderer boundaries, by replacing the foreach loop with the next code snippet:

     foreach ( Transform t in Selection.transforms )
     {
         $$anonymous$$eshRenderer renderer = t.GetComponentInChildren<$$anonymous$$eshRenderer>();
         if ( renderer != null )
         {
             RaycastHit rayhit;
             if ( Physics.Raycast( renderer.bounds.center, Vector3.down, out rayhit ) )
             {
                 float offsetY = rayhit.point.y - renderer.bounds.min.y;
                 t.position += new Vector3( 0f, offsetY, 0f );
             }
         }
     }
avatar image
5

Answer by blueriver123 · Oct 27, 2017 at 06:05 AM

try unity manual

Surface snapping

While dragging in the center using the Move tool, hold Shift and Control (Command on Mac) to quickly snap the GameObject to the intersection of any Collider.

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image sanmn19 · Apr 16, 2018 at 02:43 PM 2
Share

This should be the answer.

avatar image tfunk · Oct 12, 2018 at 03:08 PM 1
Share

This took me a second to sort out, but it works great! While holding shift+ctrl, you have to use the square in the center of the $$anonymous$$ove tool (which you said). I was initially trying to use the arrows of the move tool, which does not work.

TL;DR Be sure to use the center of the move tool, not the arrows.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

26 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How do I get the current "Highlighted" position? 1 Answer

Editor drag&drop override 1 Answer

Is it possible to set snapping for scale to units? 1 Answer

Rotation Snapping is adding harmful floats! 1 Answer

Extending Unity's Grid 1 Answer

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges