@@ -73,11 +73,12 @@ def show_visual(self, value: bool):
7373 if value == self ._show_visual :
7474 return
7575 self ._show_visual = value
76+ parent = self
7677 for i , visual_object in enumerate (self .visual_objects ):
7778 if value :
78- parent = self
79- if i > 0 :
80- parent = self .visual_objects [i - 1 ]
79+ # NOTE: This is a workaround to avoid double transformation issue with latest version of `compas_viewer`.
80+ # if i > 0:
81+ # parent = self.visual_objects[i - 1]
8182 self .scene .add (visual_object , parent )
8283 self .scene .instance_colors [visual_object .instance_color .rgb255 ] = visual_object
8384 else :
@@ -91,12 +92,13 @@ def show_collision(self):
9192 def show_collision (self , value : bool ):
9293 if value == self ._show_collision :
9394 return
95+ parent = self
9496 self ._show_collision = value
9597 for i , collision_object in enumerate (self .collision_objects ):
9698 if value :
97- parent = self
98- if i > 0 :
99- parent = self .visual_objects [i - 1 ]
99+ # NOTE: This is a workaround to avoid double transformation issue with latest version of `compas_viewer`.
100+ # if i > 0:
101+ # parent = self.visual_objects[i - 1]
100102 self .scene .add (collision_object , parent )
101103 self .scene .instance_colors [collision_object .instance_color .rgb255 ] = collision_object
102104 else :
@@ -113,8 +115,9 @@ def add_objects(objects, show_flag):
113115 for i , obj in enumerate (objects ):
114116 obj .init ()
115117 if show_flag :
116- if i > 0 :
117- parent = objects [i - 1 ]
118+ # NOTE: This is a workaround to avoid double transformation issue with latest version of `compas_viewer`.
119+ # if i > 0:
120+ # parent = objects[i - 1]
118121 self .viewer .scene .add (obj , parent )
119122 self .viewer .scene .instance_colors [obj .instance_color .rgb255 ] = obj
120123
@@ -160,10 +163,10 @@ def update_joints(self, joint_state: Configuration):
160163
161164 if self .show_visual :
162165 for obj in self .visual_objects :
163- obj ._update_matrix ()
166+ obj .update ()
164167
165168 if self .show_collision :
166169 for obj in self .collision_objects :
167- obj ._update_matrix ()
170+ obj .update ()
168171
169172 self .viewer .renderer .update ()
0 commit comments