- Home /
My Motorcycle Physics Need Some Customization
Hello everyone,
I am trying to use these codes you see below on my moto. Actually it works but it is not healthy and i am working on it for long time but i couldn't make it like i want to have.
if (Input.GetKey (KeyCode.D))
{
euler.z = Mathf.Lerp(euler.z, 40.0f, 0.05f);
Quaternion motoRotation = Quaternion.Euler(euler);
transform.rotation = Quaternion.Lerp (transform.rotation, motoRotation, 0.05f);
}
if (Input.GetKey (KeyCode.A))
{
euler.z = Mathf.Lerp(euler.z, 40.0f, 0.05f);
Quaternion motoRotation = Quaternion.Euler(euler);
transform.rotation = Quaternion.Lerp (transform.rotation, motoRotation, 0.05f);
}
Moto rotates left and right side after i hit "A" or "D" keys but it doesn't work good. For instance, when i release the key, moto turns the start Z rotation position which is "0", without smoothing. I want the moto to rotate left and right side smoothly and return back the position when key is released smoothly.
Thanks for your answers from now.
Answer by Asted · Mar 19, 2015 at 07:37 AM
http://unity3d.com/learn/tutorials/modules/beginner/scripting/get-button-and-get-key Look that, it can help
Thanks for the answer but this is not what i am looking for. I am looking for how can i modify physics codes which you see under if statements, correctly. They don't work well. They just need to be fixed and little bit smooth needs to be added.
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
check x axis rotation,limit objects rotation 1 Answer
If angle is greater than 5, do something, if less than -5, do something else [Answered] 2 Answers
Mathf.Lerp won't stop snapping 2 Answers
How to go from eulerAngle axis 270 to 0 by rotating 90 degrees? 1 Answer