- Home /
object enters trigger: how to: calculate where it's facing: and continue to calculate while in trigger
A cube enters a trigger, how do I determine which face is currently most facing the camera... And, if it rotates whilst in the trigger zone, how do I keep up to date with which face is most facing the camera?
Answer by s4vi0r · Dec 29, 2010 at 07:37 PM
Not sure if this is the best way to do it. But make 6 children to the cube. One in the center of each face with some name to identify which face you want...ex = side1, side2, etc..
Write a function that checks distance of all 6 children from the camera...return the closest child.
To check all the time, call function in update.
I did this to get dice roles. Worked like a charm.
Your answer
![](https://koobas.hobune.stream/wayback/20220613093130im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
When inside trigger, turn object on, when outside trigger, turn off 1 Answer
Using Tags with OnTriggerExit 3 Answers
check if there are no object inside a trigger 2 Answers
Collision between objects? 2 Answers