Bullets fall

hey i recently asked a question on this forum to know how to do a shooting script, found one!..but when i left click the bullet falls, no force so here is what i used please help me!:

var shot : Transform;
function Update()
{
 if(Input.GetKeyDown(KeyCode.Mouse0))
 {
 var bullit = Instantiate(shot,gameObject.FindWithTag("Respawn").transform.position,Quaternion.identity);

 }    }

addforce to the rigidbody, documentation here.

as a side note, if you type bullet into the search of either unity answers or forums, you will find all the information you want.

All you are doing there is instantiating the bullet. for it to move you need to use RigidBody.addForce (if your bullet is a rigidbody)

Example:

 var speed : int; 
 var shot : Transform;
    function Update()
    {
     if(Input.GetKeyDown(KeyCode.Mouse0))
     {
     var bullit = Instantiate(shot,gameObject.FindWithTag("Respawn").transform.position,Quaternion.identity);
     bullit.rigidboy.addForce(transform.forward * speed);
    
     }    }

You Can Also Try

bullit.rigidbody.velocity.x = speed;

Or Maybe velocity.z it depends on your Shooter But addForceWorks well too it’s just a matter of seeing which one works better for you!
this things are also mentioned in Unity3d’s FPS creating guide Part1!(I am recommending this caz this velocity was recommended by many tuts!)

place a script on your prefab that contains:

function Start()
{
rigidbody.AddForce (vector3.forward * speed);
}

if you wish to prevent the bullets dropping off as they travel uncheck gravity on your prefab.