# How to make a smooth rotation for mobil game

private void Move(Vector3 direction)
{

``````    rb.velocity = direction * speed *Time.fixedDeltaTime;

}
private void rotate(Vector3 rotation)
{
transform.rotation = Quaternion.LookRotation(rotation,Vector3.up);

}
private void FixedUpdate()
{
var direction = new Vector3(playerControl.Direction.x, 0, playerControl.Direction.y);
var rotation = new Vector3(playerControl.Rotation.x, 0, playerControl.Rotation.y);
Move(direction);
rotate(rotation);
``````

private Vector2 TouchPosition;
public Vector2 Direction;
public Vector2 Rotation;

``````public void OnPointerDown(PointerEventData eventData)
{
TouchPosition = eventData.position;
}
public void OnDrag(PointerEventData eventData)
{
var delta = eventData.position - TouchPosition;
Direction = delta.normalized;
Rotation = delta.normalized;
}

public void OnPointerUp(PointerEventData eventData)
{
Direction = Vector2.zero;
}
``````

My player rotation sometimes rotate so fast like teleporting. I want to when ı am click somewhere it is rotate smooth

Given the new description the problem you have is that you always directly set the new rotation. What i can recommend here is that you smooth your rotation input. This is what you can use `Math.Lerp` for. So instead of:

``````  Rotation = delta.normalized;
``````

You could try to write:

``````  var lerpValue = 0.1f; //must be between 0 and 1
Rotation = Mathf.Lerp(Rotation, delta.normalized, lerpValue);
``````

Which will smooth it down. Though probably too much.

if lerpValue is smaller it will be smoother. The more you move it towards 1, the faster and more instant the rotation will be.

when im writing like that it gives this error :

Error CS1503 2 Not accepted regardless of effect: Unable to convert ‘float’ from application ‘Unityine.Vector2’

the script isnt work ,still my player rotations are like teleporting. not all the time like when ı am stop the player and touch opposite direction its rotate too fast so its look like teleporting

an example the player going to x direction when ı am want to change it the direction to z its rotate too fast and this code which you shared not slowing down this rotation. may be the problem is different thing what it could be?