Collision: get variables in a class from the collider

I have a character which have script component with some variables in a class.

When this character walks into a collider/trigger cube, i want to get ahold of these variables from the trigger’s script.

The only thing I can get ahold of is the Collider:

function OnTriggerEnter (other : Collider)

…but that doesnt have the variables i want.

You simply have to create the connection between the collider and those variables.

Who owns the variable ? The component.
Who owns the component ? The gameObject.
Who owns the collider ? The gameObject.

The gameObject is the link, so :

other.gameObject (refers to the gameObject having the Collider trigger)
other.gameObject.GetComponent (Script) (refers to the component Script of the gameObject having the Collider trigger)

From there, you get any variable you want.

Hey thanks, that got me almost there.

print(other.gameObject.GetComponent("PlatformerController");

works, but this script has a variable (canControl) which is not found:

print(other.gameObject.GetComponent("PlatformerController").canControl);

gives: Assets/Scripts/P012.js(9,70): BCE0019: 'canControl' is not a member of 'UnityEngine.Component'.

OK, after alot of test an fail, i found out it has to be done in 2 steps:

var tmp : PlatformerController = other.gameObject.GetComponent("PlatformerController");
print(tmp.canControl);

GetComponent returns an object of type Component. You need to cast it to the right type:

print(((PlatformController)other.gameObject.GetComponent("PlatformerController")).canControl);

Yes, sometimes, two steps is required. Usually, you first declare the variable, then you specify its content.

var myTransform : Transform;
myTransform = other.gameObject.transform;

For example.