This code fires a bullet from enemy’s gun towards camera, but the bullet stays vertical. How do I rotate the bullet’s local coordinate system? Bullet is just a cylinder at the moment
void EnemyGunFire() {
Transform target = Camera.main.gameObject.transform;
Vector3 direction = (target.position - gun.transform.position).normalized;
GameObject bul = (GameObject)Instantiate(bullet, gun.transform.position, Quaternion.LookRotation(direction));
bul.GetComponent<Rigidbody>().velocity = direction * speed;
}