gun fire p90`s how to spawn gun fire

hey im wesley i have my guns 2 p90`s they shoot bullets that works But i dont know how to get the fire out of the gun as it shoud be is it a particle that i can make or what??. tel me sombody how to do this i have alreddy a script that i hope that works for spawning the fire when i press down my left mouse button the guns fire So can i use this script also? with little changes

the script of my p90`s Bullet.

var projectile : Rigidbody; var speed = 2000;

function Update() { if( Input.GetButtonDown( "Fire1" ) ){

var instantiatedProjectile : Rigidbody = Instantiate( projectile, transform.position, transform.rotation );

instantiatedProjectile.velocity = transform.TransformDirection( Vector3( 0, 0, speed ) );

Physics.IgnoreCollision( instantiatedProjectile. collider, transform.root.collider ); } }

thanks wes

I wouldn't recommend instantiating bullets. A P90 is a machine gun, correct? Instantiating thousands of bullets is expensive from a performance standpoint, and you can't see them anyway if they're travelling so fast. There's another problem, which is that small game objects travelling very fast often "tunnel" through colliders. In other words, they pass through the collider undetected because the game only updates every frame, but the bullet has already passed through the collider in that time.

A more typical way to handle small arms fire is raycasting. Cast a ray from the gun and detect the hit using the RaycastHit class. You can still have the muzzle flash and sound, but the raycast does the work of telling you what game object has been hit, and you can score points or inflict damage that way.

I would save instantiation for things like cannonballs, rockets, etc.

You could try:

var Bullet : Transform;    

function Update ()



        Bullet.rigidbody.AddForce(transform.forward * 2000);

Here this should work, easy and simple. Make sure the bullet has a rigidbody attatched. :)