I maded a Gun script but all my bullets don’t hit somthing they just fly through everything. Can someone help me??
Here’s the script:
var projectile : Rigidbody;
var speed = 20;
var shootsound : AudioClip; var shootanimation : AnimationClip;
function Update(){
if( Input.GetButtonDown( “Fire1” ) ) {
animation.Play(“m4a1-shoot”);
audio.PlayOneShot(shootsound);
var instantiatedProjectile : Rigidbody =
Instantiate( projectile,
transform.position, transform.rotation
);instantiatedProjectile.velocity = transform.TransformDirection( Vector3(
0, 0, speed ) );
} }