Slerp

I’m getting crazy…it’s about 5 hours i’m on this stupid problem:

I’m making a 2d games. With bullets.
I want the bullets to follow the player.
Like a tank in a war game, they continue to go forward, and constantly rotate to match the player orientation.
My code is the following, ant it is attatched to the projectile:

//Look the rotation between the player and the projectile
 Quaternion targetRotation = Quaternion.LookRotation(player.position - transform.position, Vector3.forward);

//rotate constantly the projectile based on the rotation previously calculated
 gameObject.transform.rotation = Quaternion.Slerp(gameObject.transform.rotation, targetRotation, Time.deltaTime * 2);

//at last, it moves the object (in the same direction, but it should change depending on his rotation
 gameObject.transform.Translate(Vector3.right * Time.deltaTime * speed);

I tried everything, incluing changing Vector3.forward in the first line, and Vector3.right in the latest, but nothing…the projectiles change their Z axis (even if it is 0 because it’s a 2d games), they rotate on their Y axis…i don’t know what to do, the same exact code worked in other projects…

Try changing Vector3.forward to Vector3.up in line 2, and Vector3.right to Vector3.forward in line 8.

I’d also change line 5 to either use Quaternion.RotateTowards, or change the last parameter to something like 1 - Mathf.exp(-Rate * Time.deltaTime), but that’s a more subtle point.

still nothing…they rotate 90 …they start rotating around the player (from behind him, to in front of im…on the x/z plain)