Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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 math.stackexchange.com a lot of users on that site will find the mathematical part of this problem pretty casual. –  eBusiness Sep 17 '11 at 18:13
add comment

1 Answer 1

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
add comment

Your Answer

 
discard

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.