plz help
| Vector3 startingPosWorld = this.hookParent.position; | |
| Vector3 mouse = Input.mousePosition; | |
| Vector3 startingPos = Camera.main.WorldToScreenPoint(startingPosWorld); | |
| Vector3 vectorToTarget = mouse - startingPos; | |
| float angle = Mathf.Atan2(vectorToTarget.y, vectorToTarget.x) * Mathf.Rad2Deg; | |
| Quaternion q = Quaternion.AngleAxis(angle, Vector3.forward); | |
| this.hookParent.transform.rotation = q; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment