Picking up Objects (19561)

My objective is simple, I have a character with a collider infront of him called "Hand", there is an object called "Box" I want it so when you press a button the object "Box" will parent onto "Hand" They both have coliders also.

So lets say i press Space I want the object "Box" to move and parent onto "Hand"

Dont link me to anything else as I have seen them all and they dont work...

function Update () { if(Input.GetKeyDown ("space"))

}

What now?

2 Answers

2

Try setting up your code with empty lines and comments:

function Update () 
    { 
    if(Input.GetKeyDown ("space"))
    {
        //My if statement goes here
    }

}

then start adding things. This will help you start to understand the code and allow you fend for yourself.

I also suggest rather than space you try this: http://unity3d.com/support/documentation/ScriptReference/MonoBehaviour.OnMouseDrag.html

Sorry, links are what you get when you ask something that's already got an answer: http://answers.unity3d.com/questions/52679/how-do-i-programatically-attach-objects-to-each-other/52685#52685