3D Cube Face Detection

 0 Hi,I have a set of 3D cubes placed evenly next to each other with different coloured faces, but I need to detect which face is currently showing towards the user. I have managed to use the "Forward" + "Up" calculations to detect when the cubes are all facing in the extact orientation, however I very urgently need a way to do the same thing with only the the face colour showing the user being the same! I.E. All cube faces have a different colour, as we all know the cube can show the same colour to the user but be of different orientations... This is what I need to do, but currently my game code only allows the "exact" cube orientation to react. I need to find a way to detect for example, when all cubes show the colour "Red" to the user - regardless of the orientation of the cubes. Could anyone please suggest anything or maybe something I have missed with using the "Forward" + "Up" detection method ???? Any help would be greatly appraciated.Regards, Jimmy. more ▼ asked May 16 '12 at 01:25 PM GameDev2012 0 ● 2 ● 2 ● 2 add new comment (comments are locked) 10|3000 characters needed characters left ▼ Viewable by all users

 0 You figure out how much a vector is facing another vector by calculating the dot product between the two. In this case, you'd use the camera's facing direction and the normal of the side of the cube that is facing you. There are lots of information and examples around if you look for "Unity Vector3.Dot"An even easier solution, though, would be to compose the cube out of six individual planes (or parenting them to each side of the cube) - that way, you don't have to bother with extracting the individual face normals from the cube (or trying to compute it based on the cube's rotation). more ▼ answered May 16 '12 at 02:24 PM Drakestar 916 ● 6 ● 7 ● 14 add new comment (comments are locked) 10|3000 characters needed characters left ▼ Viewable by all users

By Email:

Topics:

x289
x173
x47
x28
x24

asked: May 16 '12 at 01:25 PM

Seen: 671 times

Last Updated: May 16 '12 at 02:24 PM