Hi all,
I have another question .
So i made a code that in collision in lowers health and change particle system values, but i wanna make now when its not in collision is always in original state ? original values of the prefab ?
So basically when not in collision it values of particle system will go slowly with Time.deltatime slowly up to the original values and stay until it gets into collision again
So here is my code
But how to i make on collision exit or when its not in collision with ball the particles will go back to original state slowly.
I tried researching on google but idk how to put it in short words. I know i saw once somewhere when someone used some code to save values or particle like safe prefab values or something and then return it to original state slowly with time?
I would really appreciate if someone could help
Thanks it worked !
i have one more questions
I have this script
function OnParticleCollision (other : GameObject) {
var allChildren = gameObject.GetComponentsInChildren(ParticleSystem);
for (var child : ParticleSystem in allChildren) {
if(other.tag =="ball" && sm)
{
var v = GetComponent(ParticleSystem);
v.enableEmission = true;
}
else
{
var b = GetComponent(ParticleSystem);
b.enableEmission = false;
}
}
}
But it looks that it just sets emission to true but doesnt sets to false ?
How can i make so when its not with collision with particle it disable emmision [of smoke]
or more like if its not colliding with anything it sets to false, or original is false but ONLY when in collision with âballâ it sets to true otherwise its false ?
Thanks
but i dont want to enable child particles, i have particle ssytem on parent which i want to enable whenever the ball particle collide with the parent and when they are not colliding then disable/false emission
then why do you get all the childrenâs ParticleSystem?
so let me get this straight, you have a ball and when it collides with one of the particles of a certain particle system you want to enable that particle systems emitter for âone playâ right?
oh and the ball is also a particle, from another particle system?
So basically the âballâ is a particle system with collision
the âballâ collides with the particle system im working on that has childs which are all particle systems and it takes away health, ok i got it [its in another script the ball which takes away health]
But when the ball particle hits the particle system im working on i want it to emit extra particle system which is attached to the parent
Or is there any other way i could play particle system when ball collides with this parent of child lets say its âwallâ so is there any other way i can play another particle âhit particleâ when the ball collides with wall [they are all particle system]
But the most important is to stop playing this hit particle when its not in collision. or when not in collision stop that hit particle emission
[I made when it it hits it plays start emission on this particle system hit but i cant figure out how to stop it when collision is false, because on other function like trigger exit or collision stay, enter exit, but i didnt found any function as particleoncollisionexit i think there isnt such function so basically im looking how to make this function so when not in collision with ball the emission of hit particle is false.
do you have looping off?
if looping is off you can check if there are any particles still alive or need to be played with ParticleSystem.IsAlive(true);
Hi i looked through google and couldnt find anything tried to play around but nothing good gonna go sleep now
the looping on the particle is on, basically i just want it to play when in collision with ball, else dont play or if its not colliding with ball then stop playing it.
Thanks much it worked but idk why when its collision and plays particle some of the child particle stops playing but i will try to figure out by my self now thank you