Can i shoot Particles from a spawn point with a look-a-like script like this (i have to shoot bullets)
if (Input.GetButtonDown(“Fire1”))
{
Rigidbody instantiatedProjectile = Instantiate (projectile,
transform.position,
transform.rotation)
as Rigidbody;
audio.PlayOneShot (shoot);
instantiatedProjectile.velocity = transform.TransformDirection(new Vector3(0,0,Speed));
}
(If i can, how will it look?)
Or is it just to put a particle effect on a bullet?
Have a separate script that controls the functionality of the bullet, how fast it goes and make it travel forward, which is usually the z axis, I think.
When you instantiate the object, make sure to add your script to that gameobject and then the script will handle the rest of how the object should act out.
Now the bullet script,
Assumed to be called once per object, so you can start your stuff out in the start function.
I am assuming the instantiated call has the appropriate position and rotation.
Then all you would need to do is transform.position.z += bulletSpeed
to just go straight. Now if you want to add some physics on it you will need to give it a rigidbody and collider to stop the bullet when you hit something or delete when it hits something so there aren’t many bullets in the scene taking up memory.