I was hoping to make the zucchini translate and rotate at the same time in code. I came up with a solution, but I am thinking there must be a better way to do this. The main problem I came across was that when the sprite is rotated, the translation will move in the direction of the rotation, which overall causes the zucchini to do a loop around the screen.
Here is the solution I came up for this, but it seems a bit forced. I would be interested to know if there is more of a built in Unity way to handle this.
public class Projectile : MonoBehaviour
{
[SerializeField] private float projectileSpeed = 4f;
[SerializeField] private float rotationSpeed = 100f;
void Update()
{
Quaternion saveAngle = transform.rotation;
transform.rotation = Quaternion.identity;
transform.Translate(Vector2.right * Time.deltaTime * projectileSpeed);
transform.rotation = saveAngle;
transform.Rotate(Vector3.forward * Time.deltaTime * rotationSpeed);
}
}