Back to Forum
Raycaster - color change vertex
harp34 posted 5 years ago

Getting this error when trying to change color on hover:

three.module.js:12502 Uncaught TypeError: Failed to execute 'bufferSubData' on 'WebGL2RenderingContext': Overload resolution failed.

Code:

if(intersects.length > 0)
  {
    // console.log(intersects[0].face)
    // intersects[0].object.geometry.attributes.color.setX(0, 0)
    // // intersects[0].object.geometry.attributes.color.setY(0, 0)
    // // intersects[0].object.geometry.attributes.color.setZ(0, 1)

    // intersects[0].object.geometry.attributes.color.needsUpdate = true;

    const {color} = planeGeo.geometry.attributes;

    color.setX(intersects[0].face.a, 0)
    color.setY(intersects[0].face.a, 0)
    color.setZ(intersects[0].face.a, 1)
    color.needsUpdate = true;

Not sure of the issue but same code as yours..

Want to participate?

Create a free Chris Courses account to begin

Providing the lift to launch your development career

© 2026 Chris Courses. All rights reserved.