From bcf18a5da5b26c4dee4e295cb55b563fd89f06f6 Mon Sep 17 00:00:00 2001
From: Justin Carpentier <justin.carpentier@inria.fr>
Date: Sat, 30 Nov 2019 10:35:32 +0100
Subject: [PATCH] example/meshcar: set manual scaling

---
 examples/meshcat-viewer.py | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/examples/meshcat-viewer.py b/examples/meshcat-viewer.py
index 2191f5e00..386944246 100644
--- a/examples/meshcat-viewer.py
+++ b/examples/meshcat-viewer.py
@@ -18,6 +18,13 @@ mesh_dir = model_path
 urdf_model_path = str(os.path.abspath(os.path.join(model_path, 'romeo_description/urdf/romeo_small.urdf')))
 
 model, collision_model, visual_model = pin.buildModelsFromUrdf(urdf_model_path, mesh_dir, pin.JointModelFreeFlyer())
+
+# Currently, MeshCat is not able to retrieve the scaling from DAE files. Set it manually.
+for geom in visual_model.geometryObjects:
+  s = geom.meshScale 
+  s *= 0.01
+  geom.meshScale = s
+
 viz = MeshcatVisualizer(model, collision_model, visual_model)
 # pin.setGeometryMeshScales(visual_model,0.01)
 
-- 
GitLab