Search Unity

A way to implement any gameobject to any gameobject snapping

Discussion in 'Getting Started' started by eishersaroya, Mar 26, 2019.

  1. eishersaroya

    eishersaroya

    Joined:
    Mar 26, 2019
    Posts:
    1
    I am trying to create a simulator for AR (hololens) that would allow the simulation of a construction environment. Since it is supposed to be realistic, I want users to have a lot of control over what they can do, and there to be minimal guidance from the simulator.

    I want objects in game to be able to snap together. For instance, I want walls placed to snap to other walls, objects to snap to the ground, scaffolds to snap to place, etc. The person who I am working on this for wants people using it to be able to make mistakes, and that is why anything should be able to snap. Otherwise they will only snap things that actually fit together.

    Realistically, is this even possible in the time frame of a year (5 people working on it)? I don't want to get started and dedicate hours into a proposed solution that isn't feasible.

    Ideas that I've had so far:
    • Create a grid on every object, when the object you want to snap is close enough that part of the grid on the object changes color. Simply deselect to snap. Is there a resource efficient way to achieve this? Additionally, it seems that it'll be impractical to get an object the exact right distance from the respective location on the wall. Another issue is that if the grid doesn't match up with where the object should be placed.
    • Another possibility is that we could create sockets where objects can attach. I don't know enough about construction to know where these sockets should be placed though, and it would require creating new sockets for every gameobject.
    • Snap points were another possibility. In game, choose the snap tool and then select 2 arbitrary points on objects you want to snap together, and bam they snap together. Issue with this is the hololens isn't that accurate. The user would have to hold their head still to be able select exactly the location that want. This could be combined with a grid though, so they don't have to be quite as precise.
    • Finally we could use many different snapping methods each fit for certain situations. Use basic object snapping (snap to side when within a certain distance) for snapping walls and pillars and the like. Use sockets for studs and screws, and more precise object snapping. Use a grid when there are multiple possible locations on 1 side of a gameobject where an object can be snapped.
    Which of the ideas or feasible, if any? Are there other known methods to achieve this that I haven't mentioned? Specifically, which of the ideas are NOT feasible, and if not, why? If no one here knows, is there somewhere you can direct me to ask questions to people who might know?

    BTW, I'm a complete beginner when it comes to Unity. No experience with any game engines.
     
    Last edited: Mar 26, 2019