rotate game object on collision

what would be the best way to rotate an object 90 degrees every time a character controller makes collision with a different game object? Example: step on a switch and a cube rotates 90 degrees on specified axis. So far I’ve just got the basic:

public var WORLD : GameObject;

function OnControllerColliderHit(hit : ControllerColliderHit)

{

        if(hit.gameObject.tag == ("RotateX"))
        {

and after that I’m clueless. seems like i’ve tried just about everything and getting nowhere. Such a simple task but I’ve never dealt with rotation besides animations of rotation on contact. I’m thinking it’s gotta be something like:

var rotationSpeed : float = 2;

var rotationAxis : Quaternion;

WORLD.transform.rotation = rotationAxis(rotationSpeed * Time.deltaTime);

but I’m just not getting anywhere.
any help would be greatly appreciated

You could use a coroutine to rotate 90 degrees - it’s necessary to use an auxiliary flag to block new rotations until the object has completed a 90 degrees rotation, or each time the coroutine is called it generates a new rotation cycle even when the previous hasn’t finished:

public var WORLD : GameObject;
private curAngle: float = 0; // current rotation angle
private rotating = false; // tell when it's rotating
var rotSpeed: float = 90; // how many degrees rotate per second

function OnControllerColliderHit(hit : ControllerColliderHit){
    if (hit.gameObject.tag == ("RotateX") && !rotating){ // if not already rotating... 
        rotating = true; // I'm rotating
        while (curAngle < 90){
            var dAngle = rotSpeed * Time.deltaTime; // how much to rotate this frame
            curAngle += dAngle;                     // updates curAngle...
            World.transform.Rotate(0, dAngle, 0);   // rotates object by the same angle
            yield;  // suspend rotation until next frame
        }
        curAngle -= 90;   // prepare for next 90 degrees rotation
        rotating = false; // I'm not rotating anymore
    }
}