Skip to content

Reset Standard Material #125

Answered by jnsmalm
goldenratio asked this question in Q&A
Discussion options

You must be logged in to vote

Hey!

You could either recreate the model like this:

let gltf = resources["assets/teapot/teapot.gltf"].gltf

document.addEventListener("keydown", () => {
  // Recreate the model to reset values
   model.destroy()
   model = app.stage.addChild(PIXI3D.Model.from(gltf))
   model.y = -0.8
 })

 let model = app.stage.addChild(PIXI3D.Model.from(gltf))
 model.y = -0.8
 model.meshes.forEach(mesh => {
  // Change some props of the material
   mesh.material.exposure = 1.3
   mesh.material.baseColor = new PIXI3D.Color(1, 0, 0)
 })

Or you could store each individual value in some other variable and then set them back.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by goldenratio
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants