x


Picking up Objects

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?

more ▼

asked Apr 22 '11 at 11:46 PM

Chris 43 gravatar image

Chris 43
27 12 12 17

(comments are locked)
10|3000 characters needed characters left

2 answers: sort voted first

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.

more ▼

answered Apr 23 '11 at 12:28 AM

burgunfaust gravatar image

burgunfaust
260 5 7 17

Apr 23 '11 at 12:30 AM burgunfaust
(comments are locked)
10|3000 characters needed characters left

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

more ▼

answered Apr 23 '11 at 12:53 AM

DaveA gravatar image

DaveA
26.5k 151 171 256

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x1095
x68
x8

asked: Apr 22 '11 at 11:46 PM

Seen: 1297 times

Last Updated: Apr 22 '11 at 11:46 PM