Three.js: How to detect the clicked face of a cube and change its texture?

Created on 8 Jan 2012  路  3Comments  路  Source: mrdoob/three.js

How to detect which of the faces has been clicked

http://jsfiddle.net/yfDnJ/6/

Question

Most helpful comment

I got it in the end just using intersects[0].face.materialIndex for the material index

All 3 comments

I think you should be able to figure out the face bu retrieving the normal vector of the face that you intersected. You should have only 6 different normals ;)

I got it in the end just using intersects[0].face.materialIndex for the material index

That's smarter :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mrdoob picture mrdoob  路  66Comments

DefinitelyMaybe picture DefinitelyMaybe  路  88Comments

RicoLiu picture RicoLiu  路  100Comments

kdilayer picture kdilayer  路  62Comments

mrdoob picture mrdoob  路  84Comments