flutter_cube icon indicating copy to clipboard operation
flutter_cube copied to clipboard

Can I change texture with onTap?

Open MiracleInNutShell opened this issue 5 years ago • 3 comments

It would be so much better if I could change the texture bc Flutter Cube is the best 3d flutter package compatible with me.

MiracleInNutShell avatar Jul 11 '20 18:07 MiracleInNutShell

  loadImageFromAsset('assets/texture.png').then((value) {
    object.mesh.texture = value;
    scene.updateTexture();
  });

zesage avatar Jul 13 '20 15:07 zesage

Hi sorry to bother you again... Let's say I have an obj with different textures like a tree obj which will have leaves texture and trunk texture.So I don't know how to change texture on specific location. I'm wondering "What if we could change the mtl file of the obj?" Thanks you for your effort.

MiracleInNutShell avatar Jul 28 '20 19:07 MiracleInNutShell

Use Blender to separate tree to two objects, name “leaves” and “trunk”, then export to "tree.obj". Code:

  object.find(RegExp('leaves')).mesh.texture = value1;
  object.find(RegExp('trunk')).mesh.texture = value2;
  scene.updateTexture();

zesage avatar Jul 29 '20 15:07 zesage