Answer the question
In order to leave comments, you need to log in
How to change cube face color on hover three.js?
I use raycaster to determine the face of the cube and then paint the face like this
const colorAttribute = intersected.object.geometry.getAttribute('color');
colorAttribute.setXYZ(face.a, color.r, color.g, color.b);
colorAttribute.setXYZ(face.b, color.r, color.g, color.b);
colorAttribute.setXYZ(face.c, color.r, color.g, color.b);
colorAttribute.needsUpdate = true;
Answer the question
In order to leave comments, you need to log in
It is necessary to make 2 triangles on the plane and paint them.
https://documentation.help/three.js-en/intro.htm
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question