Search Unity

Attaching objects to mobile structures...

Discussion in 'Scripting' started by SandJosieph, Mar 3, 2015.

  1. SandJosieph

    SandJosieph

    Joined:
    Feb 17, 2015
    Posts:
    8
    I'm relatively new to the programming scene (I'm more of a meta developer). The concept I have for a game is that you're a wheel chair bound girl who has a gravity gun of sorts and in order to go places she has to pull objects from the environment around her and attach them together to make vehicles for her to pilot around. One idea I have is to create a attach point node that I could be applied to various parts of objects so when they touch they "weld" together to form a sort of vehicle matrix. The structure would be a rigid body structure but would track each part individually so it could create "stress points". Problem is, I don't have the faintest idea on how to do that or how to save it to a file. So if someone can show me a method to accomplish that task (preferably in JavaScript since I'm kinda sorta migrating from Java) would be most lovely. :)
     
  2. Juice-Tin

    Juice-Tin

    Joined:
    Jul 22, 2012
    Posts:
    244
    SandJosieph, I'll be the first to say that you're really trying to run before you've learned to walk.

    Unity is quite unlike Java and other programming languages as it's heavily based on physical objects in a scene with small scripts attached to them (as apposed to oodles of classes in Java).

    What you're asking isn't super complicated but it isn't super easy either, and even if someone gave you the complete code, you'd be unable to do anything with it without the proper knowledge.

    If you really want to create your idea, I'd highly recommend taking a few days to learn Unity through googled tutorials. Even learning it is quite fun and will fly by in no time. Once you learn how easy and fun it is, I'm sure you'll have no problem putting that game together! Best of luck!
     
  3. Tiki

    Tiki

    Joined:
    Mar 3, 2013
    Posts:
    299
    That's some pretty good advice by Juice-Tin, you'll want to be more familiar with Unity's object-oriented programming structure.

    In concept, you want to set up a number of objects you can use to make the vehicle, and give them all physics. Unity can do that on it's own. With some asset store downloads or some intuitive thought, the Unity Editor can get you to pick those objects up as well. As for piecing them together, that has to do with two coding routines:

    1. A Vehicle

    2. A complex object parenting system.

    The first one is straight forward, the second depends a lot on how you want the objects to attach.

    Like Juice-Tin said, none of these things are super-difficult, but without knowledge of UnityScript or C# and some experience with the Unity Editor, it's near impossible. I'd suggest some smaller projects to warm yourself up.
     
  4. SandJosieph

    SandJosieph

    Joined:
    Feb 17, 2015
    Posts:
    8
    Thanks guys for the advice. I've been watching some really nice tutorials and fooling around with RobotLab a bit. Cool stuff. :)