Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mesh Resource rendering changes after viewer click #291

Closed
timhodgson12 opened this issue Oct 22, 2019 · 1 comment
Closed

Mesh Resource rendering changes after viewer click #291

timhodgson12 opened this issue Oct 22, 2019 · 1 comment

Comments

@timhodgson12
Copy link

timhodgson12 commented Oct 22, 2019

I am trying to add a ros3d mesh resource to a viewer scene. Instead of saving as an stl on the api I am sending the mesh data to the client. (Must maintain this behavior) From there we instantiate the geometry with vertices and triangles.

this.viewer = new Viewer({
      divID: 'viewer',
      width: document.getElementById('viewer').offsetWidth,
      height: document.getElementById('viewer').offsetHeight,
      antiAlias: true,
      background: '#7A7AF3'
});

this.meshTopic.subscribe((msg: any) => {
     const geometry = new Geometry();
     msg.triangles.forEach(triangle => {
           const vt = triangle.vertex_indices;
           geometry.faces.push(new Face3(vt[0], vt[1], vt[2]));
      });

     msg.vertices.forEach(vertice => {
          geometry.vertices.push(new Vector3(vertice.x, vertice.y, vertice.z));
      });

      const threeMesh = new Mesh( geometry, new MeshBasicMaterial({ color: 0x999999 }));
      const mesh = new MeshResource({
          resource: 'none',
          warnings: true
      });

      mesh.add(threeMesh);
      mesh.scale.set(1, 1, 1);
      this.viewer.scene.add(mesh);
});

The initial rendering is fine.
image
However once the user clicks the viewer object the mesh re-renders in a pipe shape
image

No matter what type of mesh is rendered it always changes into the same pipe shape once the viewer is clicked.

Any idea how I can resolve this issue?

@Sevilaa
Copy link

Sevilaa commented Jan 11, 2023

I'm running into the same error. What was your solution? Currently my only solution is to remove that object from the scene and add another one, bit it clearly shouldn't be that way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants