x


Access other game object BoxCollider

Hi,

I'm trying to access an other game objects BoxCollider but can't get it right, can someone please tell me the right way, thank you.

#pragma strict

private var terrorist : GameObject; // Referance to the GameObject with the BoxCollider on it
private var boxCollider : BoxCollider;

function Awake(){

 terrorist = GameObject.Find("Terrorist Body"); // Find the gameObject with the BoxCollider
}

function Start(){

    boxCollider = terrorist.GetComponent(BoxCollider) as BoxCollider;
}
more ▼

asked Aug 05 '12 at 07:39 AM

Griffo gravatar image

Griffo
1.7k 20 48 67

I've done it ..

Aug 05 '12 at 07:50 AM Griffo
(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first
#pragma strict

private var terrorist : GameObject; // Referance to the GameObject with the BoxCollider on it
private var boxCollider : BoxCollider;

function Awake(){

 terrorist = GameObject.Find("Terrorist Body"); // Find the gameObject with the BoxCollider
}

function Start(){

    boxCollider = terrorist.GetComponent(BoxCollider) as BoxCollider;
}
more ▼

answered Aug 05 '12 at 07:52 AM

Griffo gravatar image

Griffo
1.7k 20 48 67

(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:

x2090
x1703
x81

asked: Aug 05 '12 at 07:39 AM

Seen: 357 times

Last Updated: Aug 05 '12 at 07:52 AM