Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • 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 /
  • Help Room /
avatar image
0
Question by AcidicPaper · Jan 24, 2016 at 09:02 PM · c#rigidbodyprefabsnapsnapping

Need help with snapping Prefab assets to grid in game

Hello,

My name is Dean. I got into Unity and C# programming recently to expand my knowledge of video game development. Currently I am trying to make an isometric, construction management based game (think RollerCoaster Tycoon for example) but I am having trouble in snapping the prefabs to a grid.

alt text

Whilst it's great that I've achieved this much already with the development of my game, I'm not happy that the placement of each prefab requires precise placement in the game. Each asset is roughly 5' x 5' inches, (Floor Tile and Fizz Machine especially) so ideally I want each grid space to be that, at 5' x 5'.

Also, when building the Floor Tile I would like to know how to "click and drag" a selection so that the path is created quicker, like in the same manner Streets or roads are built in Sim City 4. I think the current placement (having to click and re-click the Floor Tile UI button) of the prefabs for the path is very tedious.

alt text

I have the code here for your viewing and assistance.

Any advice on this (or ideally where to go to get my feet wet in my desire) would be fantastic. Many thanks Unity community.

Dean.

image.png (212.2 kB)
screen-shot-2016-01-24-at-210220.png (140.1 kB)
Comment
Add comment
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

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Ho-Runner · Jan 24, 2016 at 09:10 PM

@AcidicPaper, hi there. yeah snapping prefabs is easy to do. I suggest that your models (if you made them yourself) are set to the origin (0,0,0) before you export them to an .FBX, then once you have them in Unity, while you are in the transform tool, hold 'v' to access vertex snapping. it will allow you to snap the vertices of two objects together. hope this helps!

Comment
Add comment · 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
0

Answer by AcidicPaper · Jan 24, 2016 at 09:13 PM

@Ho-Runner Hi! Thanks for your speedy reply!

The objects in question were made by myself in SketchUp. So, will I need to place them at the 0,0,0 origin before putting them in again?

Keep in mind these are prefabs as well, I dont have them in the hierarchy because the UI is responsible in placing them on the game map.

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 Ho-Runner · Jan 24, 2016 at 09:45 PM 0
Share

@AcidicPaper, I would recommend it as if you bring these objects into the scene and they were not centered in the origin when they were exports, the objects will rotate strangely. so yes I recommend centering your objects before attempting to snap them. I have never used sketch up, only maya and 3ds max.

avatar image AcidicPaper Ho-Runner · Jan 25, 2016 at 12:00 AM 0
Share

I'm sorry. How do you mean by this? In Layman's terms :P

avatar image Ho-Runner · Jan 25, 2016 at 12:17 AM 0
Share

ok. open up whatever modeling program you are using and open your objects. use the transform tool and set the position of your objects to (0, 0, 0). then export the objects in an FBX file. then put these fbx's into unity

avatar image AcidicPaper Ho-Runner · Jan 25, 2016 at 12:33 AM 0
Share

I dont believe SketchUp provides that :(

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.

Follow this Question

Answers Answers and Comments

71 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 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 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

snap object to another object 2 Answers

Moving an object a fixed amount on its local axis 1 Answer

How do I keep the player with rigidbody from going through the wall 1 Answer

How To Move A Ball Using Touch Input? 0 Answers

A script that doesn't allow moving objects to go through non-moving objects? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges