i need calculate normal of 6 faces from cube.
The cube is moved with keys, so, as the position of cube i need know normal face.
There any method that help this calculation??
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you maintain the relationship between faces you can calculate one and then get all the others using transformations. Or you can just calculate all six individually.
The easiest way to do it is to use the cross-product of two edge vectors and normalize the result to get a unit vector in 3D.
Pick any cube surface that has points (1, 2, 3, 4) numbered in such a way that if you look down the unit vector normal to the face the numbers run in the counterclockwise direction.
Calculate the vectors between points 1 and 2:
Same for a vector running from point 1 to point 4.
Cross the first vector into the second, normalize it, and that’s your unit vector.