Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 /
This question was closed Apr 20, 2013 at 08:28 PM by Eugenius for the following reason:

The question is answered, right answer was accepted

avatar image
1
Question by Eugenius · Jan 20, 2013 at 08:46 PM · gridsnapsnapping

Is there a way to check if something was snapped on a specific grid?

Here's the thing.

I currently have a large(large-ish) grid, with expandable areas. I would like for each expandable are to be composed of x*y grids and for any player to be able to place and/or move the objects according to the grids.

I already found a tutorial of some sort showing me how to move the object based on the grid's dimension (hope it's good though).

I would like to know if there is a possibility of checking if a specific grid already has an object snapped to it? (this is to make sure that it's not possible to snap two things on the same spot).

Regards

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

1 Reply

  • Sort: 
avatar image
2
Best Answer

Answer by jwinn · Jan 21, 2013 at 01:05 AM

This is entirely dependent on what code you are using for grid snapping. You would do a check that something is not there, before allowing snapping of the current object you are moving. Or perhaps you would allow the snapping, but make the object red and not allow it to be placed.

There are several ways to check if there is an object there. You could have a trigger/collider on the already snapped object, that registers a trigger collision with your cursor or whatever you are moving around. Another way, is if you have an array storing all of the grid cells, you could have a boolean that says whether it's used (or if the type of object is stored in the array, you would just check if it is empty).

Comment
Add comment · Show 1 · 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 Eugenius · Jan 21, 2013 at 01:40 AM 0
Share

Great advice! Thank you, I think I am going to go with storing all my grids in an array as that seems to be the easiest and most efficient solution for me! I can't express my gratitude enough.

Follow this Question

Answers Answers and Comments

10 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

Related Questions

Grid snapping 0 Answers

Create Grid and Snap Rigidbodies to Grid 1 Answer

cannot get snap to grid to activate 0 Answers

Snap to grid edge midpoints? 1 Answer

Snap to grid not working for me 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