Hey guys, I am confused. Checking the console log shows that the forward rotation is changing, but whenever i press F, the bullet always shoots in the same direction regardless of where my mouse is:
if (Input.GetKeyDown(KeyCode.F)){
GameObject shot = GameObject.Instantiate(bullet, transform.position + (transform.up *4), transform.rotation) as GameObject;
Rigidbody shotRigidBody = shot.AddComponent<Rigidbody>();
Plane zeroPlane = new Plane(Vector3.up, Vector3.zero);
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
float distance;
if(zeroPlane.Raycast(ray, out distance))
{
Vector3 outputPosition = ray.origin + ray.direction*distance;
shot.transform.LookAt(outputPosition);
Debug.Log(shot.rigidbody.rotation);
}
shot.rigidbody.AddForce(transform.forward*force);
}