Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private Vector3 PlaceOnCircle(Vector3 position) {
- Ray ray = Camera.main.ScreenPointToRay (position);
- Vector3 pos = ray.GetPoint (0f);
- // Making 'pos' local to... ?
- pos = transform.InverseTransformPoint (pos);
- float angle = Mathf.Atan2 (pos.x, pos.z) * Mathf.Rad2Deg;
- pos.x = circle.radius * Mathf.Sin (angle * Mathf.Deg2Rad);
- pos.z = circle.radius * Mathf.Cos (angle * Mathf.Deg2Rad);
- pos.y = 0f;
- return pos;
- }
Add Comment
Please, Sign In to add comment