Verified Commit 6f14e49e authored by Justin Carpentier's avatar Justin Carpentier
Browse files

python/meshcat: fix scaling when loading a mesh

parent e2a8ea13
......@@ -175,11 +175,13 @@ class MeshcatVisualizer(BaseVisualizer):
viewer_name = self.getViewerNodeName(geometry_object, geometry_type)
is_mesh = False
try:
if WITH_HPP_FCL_BINDINGS and isinstance(geometry_object.geometry, hppfcl.ShapeBase):
obj = self.loadPrimitive(geometry_object)
elif isMesh(geometry_object):
obj = self.loadMesh(geometry_object)
is_mesh = True
elif WITH_HPP_FCL_BINDINGS and isinstance(geometry_object.geometry, hppfcl.BVHModelBase):
obj = loadBVH(geometry_object.geometry)
else:
......@@ -209,6 +211,10 @@ class MeshcatVisualizer(BaseVisualizer):
material.opacity = float(meshColor[3])
self.viewer[viewer_name].set_object(obj, material)
if is_mesh: # Apply the scaling
scale = list(np.asarray(geometry_object.meshScale).flatten())
self.viewer[viewer_name].set_property("scale",scale)
def loadViewerModel(self, rootNodeName="pinocchio", color = None):
"""Load the robot in a MeshCat viewer.
Parameters:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment