I’m creating a sort of tps and I want to shoot a bullet in the rotation position of the player but it dosn’t work. Here the part that create the bullet and shot it (supposed to shot it). I don’t really understand why it’s not working.
void shot()
{
float angleX = transform.rotation.eulerAngles.x;
float angleZ = transform.rotation.eulerAngles.z;
float posPlayerX = transform.position.x;
float posPlayerZ = transform.position.z;
Instantiate(bullet, new Vector3(posPlayerX+2, 0.44f, posPlayerZ), Quaternion.identity);
bullet.transform.Translate(Mathf.Cos(angleX) * bulletSpeed * Time.deltaTime, 0f, Mathf.Sin(angleZ) * bulletSpeed * Time.deltaTime);
}
Thanks for helping