Hello,
I am making a simple plane game. When you press up and down you change the pitch; right and left the yaw.
When the yaw change i would like the plane to slighty change is roll (visualy). So i made a parent with the script and a child with the model of the plane.
This is how i yaw:
if (Input.GetAxis("horizontal") < -0.5)
{
transform.Rotate(0, -15f * Time.deltaTime, 0);
var target = Quaternion.Euler(0, 0, 45);
PlaneMesh.transform.localRotation = Quaternion.Lerp(PlaneMesh.transform.rotation, target, 0.5f);
}
else
{
var target2 = Quaternion.Euler(0, 0, 0);
PlaneMesh.transform.localRotation = Quaternion.Lerp(PlaneMesh.transform.rotation, target2, 1f);
}
But my quaternion.lerp don’t work, the mesh yaw more than the parent and keep turning. If there is no lerp (1f) it behaves like i want but it’s not smooth. Any idea ?