I want to get the angle between the rotation (euler Angles) of the camera (V1 : Vector3) and the collision point of my character, when it hits a wall, to determin, if it was left, right, or in front of it.
I tried to use Vector2.Angle with V1 and V2 (ControllerColliderHit.moveDirection as a Vector2) to get the difference between them.

However I get a different value (0, 90, 180) when running into the wall depending on the world direction. (left wall, right wall, etc.)

How can I get the angle of the collision point relative to the direction the camera is facing?

enter image description here

  • \$\begingroup\$ What vector are you using to represent the camera's forward vector in Vector2.Angle? \$\endgroup\$ – Ryan Jun 4 '16 at 20:52
  • \$\begingroup\$ It's orientation (transform.rotation) \$\endgroup\$ – 000000000000000000000 Jun 4 '16 at 21:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.