Open thatuserb opened 2 years ago
I have a similar issue. I subclassed trimesh.viewer.SceneViewer
and want to add meshes on user interaction. I do this in on_key_press()
by calling self.add_geometry()
, however nothing happens. Same with self.scene.add_geometry()
Edit: I got it somewhat working. Seems like you need to add the geometry both, to the viewer, and to the scene, while making sure that the names match.
# inside SceneViewer subclass
geom_name = "some_name"
geom = trimesh.primitives.Sphere(radius=0.01, center=[1,2,3])
self.add_geometry(geom_name, geom)
self.scene.add_geometry([geom], geom_name=geom_name)
I cannot seem to add geometries, specifically Trimesh objects to a viewer (the final goal is to freely replace one of the displayed meshes while rendering). When I run this code snipped, the first 2 attempts show the box and the cylinder, but the 3rd attempt does not show the cylinder:
The log output goes
I am using Python 3.9.7 in Windows 10 with trimesh 3.12.6 and pyglet 1.5.26 (EDIT1): I added the log output