How can I turn the direction of bicycle in Unity?

Hi I am new to the Unity and I am making Bicycle project in my school. I am facing a problem regarding turning the bicycle. I am attaching the YouTube link for the video which I made in which you can see the problem. I am also copying the C# Script below. Please help me through this.

YouTube Video Link : - YouTube

Thank You

C# Script:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class player : MonoBehaviour
public Animator anim;
public Rigidbody rbody;
private bool run;

private float inputH;
private float inputV;

void FixedUpdate(){
	Rotation ();

private float wantedYRotation;
private float currentYRotation;
private float rotateAmountByKeys = 2.5f;
private float rotationYVelocity;
void Rotation(){
	if (Input.GetKey(KeyCode.LeftArrow)) 
		wantedYRotation -= rotateAmountByKeys;
	if (Input.GetKey(KeyCode.RightArrow)) 
		wantedYRotation += rotateAmountByKeys;
	currentYRotation = Mathf.SmoothDamp (currentYRotation, wantedYRotation, ref rotationYVelocity, 0.25f);

// Use this for initialization
void Start () 
	anim = GetComponent<Animator>();
	rbody = GetComponent<Rigidbody> ();
	run = false;

// Update is called once per frame
void Update () 
	if (Input.GetKey (KeyCode.LeftShift)) {
		run = true;
		run = false;

	inputH = Input.GetAxis ("Horizontal");
	inputV = Input.GetAxis ("Vertical");

	anim.SetFloat("inputH", inputH);
	anim.SetFloat("inputV", inputV);

	float moveX = inputH*100f*Time.deltaTime;
	float moveZ = inputV*100f*Time.deltaTime;

	if (moveZ <= 0f) 
		moveX = 0f;
	else if (run) 
		moveX *= 2f;
		moveZ *= 2f;

	rbody.velocity = new Vector3 (moveX, 0f, moveZ);


have you applied the rotation?


Thank you for your response. I am new to the Unity so I exactly don’t know how to use rotation in this script. Can you please give me some idea regarding this?

Hmm, not quite sure what you wanna do, but try this:-

transform.rotation = Quaternion.Euler (X, Y, Z);

Note: Replace X,Y, Z with the rotation you want on every axis.

If you want to make it rotate continuously on a specific axis, use this:-

Quaternion rot = Quaternion.Euler (0, rotationSpeed, 0);
transform.rotation *= rot;

Note: Put rotationSpeed in the axis you wanna rotate, like this

X-axis > Quaternion.Euler (rotationSpeed, 0 , 0);

Y-axis > Quaternion.Euler (0, rotationSpeed, 0);

And so on…