Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In Unity3d, i can get the normal of the surface with which the collider collides using hit.normal, but is there a way to find which side has been hit what is provided bu Unity3d?

One solution is to see the orientation of the normal, and should work well for static objects but what about dynamic and moving objects whose orientation changes?

share|improve this question
Exactly what you need to do depends on what data you have got and how it is represented, you should specify that exactly. Knowing that, someone can probably figure a matrix multiplication for the job, I'm not very strong in that field so I'll leave that to someone else. If you don't get a suitable here you could ask on a lot of users on that site will find the mathematical part of this problem pretty casual. – aaaaaaaaaaaa Sep 17 '11 at 18:13
up vote 2 down vote accepted

Try the following: Translate the hit.normal into the local space of your collider (via InverseTransformDirection), then compare the sign of the vector coordinates to the local directions.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.