- Home /
Tilt character when rotating
So as the title suggests I'm trying to add a slight tilt to my character whenever he's turning similar to this video https://www.youtube.com/watch?v=hg7PQ0pMn_k I have found a couple of forums that cover this and I tried using Transform.Rotate(transform.forward * 5); but that only just made the character cartwheel. I tried euler angles too float z = Input.GetAxis("Horizontal") * 15.0f; Vector3 euler = transform.localEulerAngles; euler.z = Mathf.Lerp(euler.z, z, 2.0f * Time.deltaTime); transform.localEulerAngles = euler;
but that just gave the same cartwheel effect and I lost the ability to actually turn. If anyone could suggest a better way of doing this I would greatly appreciate it. I plan on also altering the tilt value depending on the acceleration of the character after watching this GDC talk https://www.youtube.com/watch?v=LNidsMesxSE to make the movement feel more natural in the future.