Question by
unity_H-cMYvxmrkI4cg · Mar 13, 2021 at 07:44 PM ·
c#cameracanvas
How to point an Arrpw(Image) towards placed object AR ?
Hi am trying to make an arrow in the screen (AR) to point to an object(left , right , up and down).
so far I have this and only works on left and right not up and down :
Vector3 objectinworld = Camera.main.WorldToScreenPoint(spawnObject.transform.position);
Vector3 dir = (objectinworld - image.position).normalized;
float angle = Mathf.Rad2Deg * Mathf.Atan2(dir.x, dir.y);
image.rotation = Quaternion.AngleAxis(angle, Vector3.forward);
Comment