zesage / flutter_cube

A Flutter 3D widget that renders Wavefront's object files.
Apache License 2.0
267 stars 91 forks source link

Update texture #25

Open GioLomba opened 3 years ago

GioLomba commented 3 years ago

i have a scene and a 3d object (parent) with 2 childreen. cube0= Object(filename: 'assets/parent.obj'); cube1 = Object(filename: 'assets/child1.obj'); cube2 = Object(filename: 'assets/child2obj'); cube0.add(cube1); cube0.add(cube2); scene.world.add(cube0);

i want to update the texture of cube1 with an image If i write: cube1.mesh.texture = (load image /image1.jpg) scene.updateTexture(); // not working

If i want to update the texture of cube0 with an image and i write: cube0.mesh.texture = (load image /image0.jpg) scene.updateTexture(); // update cube0 and his sons

Any solution?

Arham-Aalam commented 3 years ago

I am having same issue, I have created a separate global variable called _scene. When updating it like this it is not updating the scene.

face.position.setValues(x, y, z);
_scene.update();
Arham-Aalam commented 3 years ago

Just tried this solution and it worked:

face.updateTransform();