- Home /
2D Smoke or Particle
Hello,
what i'm trying to achive is a smoke or a cloud that disappear after a second (like the mac dock when you move an icon out of it )
the smoke or cloud appears when i enable it and after a second it disappear like the mac dock example
Thanks
PS: my game is 2D and using JS.
Answer by chris_taylor · Jul 24, 2013 at 09:20 AM
Not really sure what you are asking but im going to guess your asking if you should make your own "2D smoke" or use the particle system built into unity.
If by 2D smoke you mean making your own 2D particle effect then I would just make a particle effect with the particle system that is already there. If you need help with either one I suggest posting what you have tried that way it is easier for us to help you.
Answer by Imankit · Jul 24, 2013 at 09:34 AM
You can do this.. When you want to make this effect.. enable your cloud.. Move it up and then lerp its alpha to zero.. Or you can make an animation for that and call that animation
Example :
public Transform cloud;
//When you want your cloud to appear -
cloud.gameObject.active = true;
// To move it to a distance of 0.5f up
cloud.transform.position = new Vector3(cloud.transform.position.x,Mathf.Lerp(cloud.transform.position.y,cloud.transform.position.y+0.5f,2f),cloud.transform.position.z);
//for disappearing your cloud in your disappear condition write
cloud.gameObject.renderer.material.color.a = Mathf.Lerp(1f,0f,2f);
All these things should be in update