I’ve made an empty game object that rotates with the keyboard input up to 80 and down to -80 eulers, and attached to it a gun item with a simple script.
Rigidbody2D Bullet = Instantiate(bulletPrefab,transform.position,transform.rotation) as Rigidbody2D;
Bullet.velocity = transform.TransformDirection(new Vector3(shootingSpeed,0,0));
*Since i’m just rescaling the whole character -1 when turning and TransformDirection doesn’t get scaled, i get the effect in the picture: the velocity is set as if i didn’t flip the object.
I’ve tried by multiplying quaternions like this to no avail, most likely because i don’t understand quaternions:
Quaternion bonus = Quaternion.Euler (0,0,180);
Quaternion newrotation = transform.rotation*bonus;
Rigidbody2D Bullet = Instantiate(bulletPrefab,transform.position,newrotation) as Rigidbody2D;
Any idea?