Hi, I have a chest that opens and closes with OnTrigger , I would put a particle emitter in the chest, and just turn it on when the chest is opened. Here is the script I’m using, I would like someone help him. Thank you.
var AngleX : float = 0.0;
var AngleY : float = 0.0;
var AngleZ : float = 0.0;
private var targetValue : float = 0.0;
private var currentValue : float = 0.0;
private var easing : float = 0.1;
var Target : GameObject
function Update () {
currentValue = currentValue + (targetValue - currentValue) * easing;
Target.transform.rotation = Quaternion.identity;
Target.transform.Rotate (0 , 0, currentValue);
}
function OnTriggerEnter (other : Collider) {
targetValue = AngleX;
currentValue = 0.0;
}
function OnTriggerExit (other : Collider) {
currentValue = AngleX;
targetValue = 0.0;
}