x


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;    
}
more ▼

asked Mar 09 '12 at 03:28 PM

richard.falcos gravatar image

richard.falcos
16 6 12 17

Ok, what have you tried, yet?

Mar 09 '12 at 03:45 PM by0log1c
(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first
more ▼

answered Mar 09 '12 at 03:45 PM

Berenger gravatar image

Berenger
11k 12 19 53

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 .

Mar 09 '12 at 06:03 PM richard.falcos

If the particle emitter is attached to the same game object than that script, add particleEmitter.emit = true / false to the OnTrigger functions.

Mar 09 '12 at 07:14 PM Berenger
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x318
x72
x31

asked: Mar 09 '12 at 03:28 PM

Seen: 421 times

Last Updated: Mar 09 '12 at 07:14 PM