Touch movement with perspective camera

Hi there,

I am trying to move with touch the player on a top down view and it works perfectly on orthographic view. But when it comes to perspective it behaves completely irrationally.

Here is the script that does the job in perspective:

case TouchPhase.Moved:
	Vector3 target = Camera.main.ScreenToWorldPoint (new Vector3 (Input.mousePosition.x, Input.mousePosition.y, 10.0f));
	this.m_rigidbody.transform.position = new Vector3 (this.m_rigidbody.transform.position.x, this.m_rigidbody.transform.position.y, this.m_rigidbody.transform.position.z + (float)0.2);
	this.m_rigidbody.transform.Translate (Vector3.MoveTowards (this.m_rigidbody.transform.position, target, 160 * Time.deltaTime) - this.m_rigidbody.transform.position);
	//m_rigidbody.rotation = Quaternion.Euler (0.0f, 0.0f, m_rigidbody.velocity.x * -10);
	break;

Any ideas?

Hey @kkosnull

Have you found a solution for this problem im also having an issue with this?

You need to create two camera one in orthographic and the other in perspective.
deactivate the one which is orthographic so the display only shows the perspective one. Then in script get a refrence to the orthographic one and use it to get the touch position.

i.e
public Camera OrthographicCamera;

void Update
{
vector2 touchpoint = OrthographicCamera.ScreenToWorldPoint(Input.GetTouch(0));
}