Hi, im making a FPS game, but when i shoot i want the camera starts following the object, like bullet time in matrix, i’ve tried a lot of “answers” with similar topics at this site, but i cant get it to work, here is the code where i create the bullet:
var bullet:GameObject;
var sound1: AudioClip;
function Start () {
}
function Update () {
if(Input.GetButtonDown("Fire1")){
audio.PlayOneShot(sound1);
var bulletInstance:GameObject = Instantiate(bullet,transform.position,Quaternion.identity);
Physics.IgnoreCollision(transform.root.collider , bulletInstance.collider);
bulletInstance.rigidbody.AddForce(
Camera.mainCamera.transform.TransformDirection(Vector3(0,0,100))
,ForceMode.Impulse);
}
}
thanks!