- Home /
Question by
tonky123t · May 24, 2012 at 02:58 PM ·
particle emitter
Particle Emitter
Hello new to scripting, have got a firing weapon but trying to get a emitter to turn on when i fire has proved a bit of a problem ! Hoping someone can help me out
var bulletPrefab : Rigidbody;
var speed = 20;
var targetSound: AudioClip;
function Awake()
{
var goEmitter : GameObject = GameObject.FindWithTag("Seagull");
}
function Update()
{
if( Input.GetButtonDown( "Fire1" ) )
{
audio.clip = targetSound;
audio.Play();
BroadcastMessage("Firing!");
goEmitter.particleEmitter.emit = true;
}
var bullet : Rigidbody = Instantiate(bulletPrefab, transform.position, transform.rotation );
bullet.velocity = transform.TransformDirection( Vector3( 0, 0, speed ) );
Physics.IgnoreCollision( bullet. collider, transform.root.collider );
}
Comment
Answer by Jessica_Ann · May 25, 2012 at 06:49 PM
Try calling play on your particle system after you turn your emitter.emit to true.
Your answer
Follow this Question
Related Questions
Particle effects Back Fire 1 Answer
my partical fade away when the emitter moving fast ? 0 Answers
How do I place a script into an object? 1 Answer
Particle Emitter follow certain part of Prefab,Particle Emitter Follow Certain Part of Prefab ? 2 Answers
Particle system won't restart emitting before last particle has died 3 Answers