{
float velocity = bulletVelocity * Time.deltaTime;
if(Input.GetMouseButtonDown(0))
{
GameObject bulletPrefab_ = Instantiate(bulletPrefab, new Vector3(firePos.position.x, firePos.position.y, firePos.position.z), firePos.rotation);
bulletPrefab_.GetComponent<Rigidbody>().velocity = velocity * transform.forward;
}
}
#Bullet goes only to one side
1 messages · Page 1 of 1 (latest)
Why are you using transform.forward instead of firePos.forward to set the velocity?
Also, multiplying the velocity with deltaTime logically makes no sense.
And you don't need to create a new Vector3 in the Instantiate call; you can simply pass in firePos.position directly.
thank you, works like a charm now