Jump to content
This site uses cookies! Learn More

This site uses cookies!

armedunity.com uses cookies to improve user experience.

By continuing to use this site, you agree to allow us to store cookies on your computer.

  • 0
Sign in to follow this  

Object tilt on movement doesnt quite work as intended


So, what i want is for a transform to tilt a bit based whenever he is walking to left or right, but the problem is that, if i start tilting in negative direction (Which is to right side), my character doesnt quite rotate as it should,

this is got to do something with eulerAngles probably, so my question is, how does one solve this?

Please login or register to see this code.


Share this post

Link to post
Share on other sites

4 answers to this question

Recommended Posts

  • 0

Here's a script size cut:


void Update()


float v = Input.GetAxisRaw("Horizontal");

Vector3 r = transform.localEulerAngles;

r.z = Mathf.Lerp(r.z, v * 15.0, 2.0 * Time.deltaTime);

transform.localEulerAngles = r;



but onto your question. If Euler isn't working correctly, try localrotation. I tend to always localrotation over localeuler


@UnityGamesRolandbeat me to it lol

  • Like 1

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Create New...