I’m building a Starfox clone, and I want the ship to tilt ever so slightly based on player input, then return when the player releases the input, as a primarily cosmetic effect. Here’s the relevant code:
float pitch = -axis.y * pitchSize;
float roll = -axis.x * rollSize;
var ea = ship.transform.localEulerAngles;
ea = Vector3.Lerp(ea, new Vector3(pitch, 0, roll), tiltSpeed);
ship.transform.localEulerAngles = ea;
Where ship is a child of my gameObject.
When tilting to one side, it behaves exactly as I expect. When tilting to the other, the model spazzes out. What am I missing?