New answers tagged

0

I had trouble with Daniel's answer in my Phone, but I have found the answer for the problem it if (Input.GetMouseButtonDown (0)) { if (UnityEngine.EventSystems.EventSystem.current.currentSelectedGameObject) return; GetComponent<Rigidbody2D> ().AddForce (Vector2.up * force); } Thanks to Georgedarocha, source: ...


0

The step you are missing is the perspective divide. To calculate the value to divide by you have to do the perspective matrix math anyway so you might as well convert the point from world space into screen space and solve the problem in 2D screen coordinates. If you're curious about the math involved you can read up on how the perspective matrix works here



Top 50 recent answers are included