May be question is a bit unclear. I have implemented touch and drag to rotate camera around player functionality. Almost everything is working fine, only one issue I have in this. When I touch on screen, camera rotates a bit which should not be happening. I want camera to rotate around player according player drag. Please check code below and let me know why it might be happening.
public void OnPointerDown(PointerEventData eventData)
{
_lastPos = eventData.position;
Debug.Log("On Pointer Down");
}
public void OnPointerUp(PointerEventData eventData)
{
Debug.Log("On pointer Up");
characterMotor.DragToRotate(0);
_lastPos = Vector2.zero;
}
public void OnPointerMove(PointerEventData eventData)
{
var currentPos = eventData.position;
var x = currentPos.x - _lastPos.x;
x /= 10f;
characterMotor.DragToRotate(x);
Debug.Log("X - " + x);
_lastPos = currentPos;
}