- Home /
Question by
richard.falcos · Mar 09, 2012 at 03:28 PM ·
particleonoff
Particle on and off
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;
}
Comment
Answer by Berenger · Mar 09, 2012 at 03:45 PM
Thanks, did not help much because costaria to attach the lines of your tip in my script and I do not know exactly how to do .
If the particle emitter is attached to the same game object than that script, add particleEmitter.emit = true / false to the OnTrigger functions.
Your answer

Follow this Question
Related Questions
particle emitter on/off using the left mouse button 1 Answer
Particle system turns on when player gets close. 1 Answer
Enable and Disable a script 1 Answer
Lights wont turn back on 1 Answer