Accessing WheelCollider from other GameObjects

Hi, I’m trying to cache a reference to my WheelColliders in the Start function, but I’m having trouble finding it. What I’m trying to do is this:

private var frontWheelCollider : WheelCollider;

function Start () {

    frontWheelCollider = GameObject.FindWithTag ("Bike").transform.rigidbody.collider;

}

But as we all already know the above doesn’t work. The WheelCollider I’m trying to access on my “Bike” game object is named “frontWheelCollider”.

Any help is very appreciated :slight_smile:
Thx

So I found the answer to my own question after looking for hours and trying different ways…here it is below for anyone who might have the same problems :slight_smile:

private var frontWheelCollider : WheelCollider;

function Start () {

    frontWheelCollider = GameObject.Find ("2dBike/Colliders/frontWheelCollider").GetComponent.<WheelCollider>();

}

Basically I wasn’t “getting” the right component from the right object. First I had to “Find” the WheelCollider GameObject (frontWheelCollider) and then “Get” the component attached to it (WheelCollider).