Company logo
  • Jobs
  • Bootcamp
  • About Us
  • For professionals
    • Home
    • Jobs
    • Courses and challenges
    • Questions
    • Teachers
    • Bootcamp
  • For business
    • Home
    • Our process
    • Plans
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Calculator

0

62
Views
Cannot change the color of a material with gui in three js

I've created a new meshPhysicalMaterial with

var carMaterial = new THREE.MeshPhysicalMaterial({});
carMaterial.name= "blackPaint"
carMaterial.color=0x131316

Then, with gui, I'm trying to access the color property to change it dinamically

var params = {
    color: 0xff00ff
}

const materialFolder = gui.addFolder('Customize carbody')
materialFolder.addColor(params, 'color').onChange(function(){carMaterial.color.set(params.color)})

But when I pick a new color the console always says

index.js:324 Uncaught TypeError: carMaterial.color.set is not a function at ColorController.__onChange (index.js:324:86) at ColorController.setValue (Controller.js:92:23) at ColorController.setValue (common.js:57:27) at setSV (ColorController.js:242:13) at HTMLDivElement.fieldDown (ColorController.js:160:27)

Note: I'm using three.js version 142

7 months ago ยท Juan Pablo Isaza
Answer question
Find remote jobs