i want to move camera
no matter touch or mouse , maybe it has a relation between deltaposition and screensize,i think.
- i want to , finger’s equal with camera in deltapostion
- finger’s deltapsition better than camera position , when screen size is too large
- finger’s deltapsition less than camera position , when screen size is too small
e.g screen aspect is 1280 800. let’s reduce it acrroding to the proportion. it will show “2”.
how can i handle it…
Hi daniel,
You can do the code given below.
if(Input.GetMouseButtonDown(1))
{
mouseOrigin = Input.mousePosition;
isPanning = true;
}
if (isPanning)
{
Vector3pos = Camera.main.ScreenToViewportPoint(Input.mousePosition - mouseOrigin);
Vector3move = newVector3(pos.x * panSpeed, pos.y * panSpeed, 0);
transform.Translate(move, Space.Self);
}
Thanks