Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question Help with building system for sandbox game

Discussion in 'Scripting' started by Khaoscraft, Sep 14, 2020.

  1. Khaoscraft

    Khaoscraft

    Joined:
    Jul 23, 2020
    Posts:
    10
    Hello. So this is going to be a mix of physics, scripting, and XR, but I thought that scripting would be the best place to post this.

    I want to make a sandbox building game, and what I need is a script for when a block or part is released(not grabbed), it checks for any adjacent blocks or parts it collides with, snaps itself to a grid, and fixedJoints itself with the adjacent parts, and clears all the fixedJoints if it is grabbed again. Another thing I need is to be able to define which faces of a block or part are attachable to and which are not. I am a relative beginner to unity, and have absolutely no idea how to do any of these, and I would appreciate any help I can get with this very large request. Thank you, and please don't just respond with "you should learn more unity before doing this", I understand that I am in no position to do this type of thing on my own.
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,760
    There's not much more to this than exactly what you are suggesting we do not suggest to you.

    I'll suggest something else then: do as many Youtube tutorials as you can get your hands on that are similar to what you are doing. You won't find one that does all of it, so cover the elements and learn how to break your problem down.

    I guarantee that approach will cause you to ultimately be successful if you put the effort in.

    Otherwise, best of luck!
     
    Joe-Censored likes this.
  3. Khaoscraft

    Khaoscraft

    Joined:
    Jul 23, 2020
    Posts:
    10
    Yes sir
     
  4. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    6,469
    IMHO that seems over engineered.
    You only need a grid and hashing the position to it, a 3D arrays (chunks) would be the best way to approach it. Ie write the data to the array when released.
    Looking up the hashed world position to the array would take care of that. Basically read the data that is adjacent, then decide, then draw the object appropriately.

    Look for minecraft tutorial, not the easy stupid one, but the one that work with mesh optimization, chunks, etc ... that will give you inspiration.