how can I change the scene after throwing a dice??

Hello.I am using a dice in my game.I want to change my scene after throwing this dice. But I can’t do this properly because I couldn’t find this line (Application.LoadLevel(“firstLevel”); ) place in my code. After throwing dice , it has some rotation on the plane. I want to change scene aftar these rotations. My code :

public var faceValue = 0;

function OnTriggerEnter( other : Collider ) {

dieGameObject = GameObject.Find(“SixSidedDie”);

dieValueComponent = dieGameObject.GetComponent(“DieValue”);

dieValueComponent.currentValue = faceValue;




Main problem is this : with this codes when dice and plane have a collision with eachother scene is changed but I want this change happens after dice stops on the plane.

You will need to know when the dice are in motion, and when they have stopped. How are you moving the dice? In any case, in an Update function, get the velocity (and time). After a set amount of time has passed after you detect that their velocity(s) are zero, then call Application.LoadLevel.

The best way to detect whether the two dice have stop moving is to put a character controller on each one. a character controller has a velocity variable that you can check whether or not that object is moving.

So if you check when the two velocities have hit zero then you can load your new level. good luck.