From 4fe7a0fba93b43cb1d73133d0aea1a56df54b8de Mon Sep 17 00:00:00 2001 From: Ayman Habib Date: Tue, 3 Sep 2024 11:49:31 -0700 Subject: [PATCH] Fix visualization of pathpoints defined wrt offset frames (#1518) * Fix visualization of pathpoints defined wrt offset frames * Update CHANGELOG.md [skip ci] --- CHANGELOG.md | 1 + .../org/opensim/threejs/ModelVisualizationJson.java | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b1585b888..4b7b92c1d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ v4.6 ====== - Fix issue [#1494](https://github.com/opensim-org/opensim-gui/issues/1494): Changing muscle path color throws exception. - Fix issue [#1493](https://github.com/opensim-org/opensim-gui/issues/1493): Rotating experimental data fails or results an unusable file. +- Fix issue [#1516](https://github.com/opensim-org/opensim-gui/issues/1516): Chains of Physical offset frames ignored when displaying GeometryPath v4.5 ====== diff --git a/Gui/opensim/view/src/org/opensim/threejs/ModelVisualizationJson.java b/Gui/opensim/view/src/org/opensim/threejs/ModelVisualizationJson.java index ec7b9a9e5..9ffe02afd 100644 --- a/Gui/opensim/view/src/org/opensim/threejs/ModelVisualizationJson.java +++ b/Gui/opensim/view/src/org/opensim/threejs/ModelVisualizationJson.java @@ -1602,7 +1602,15 @@ public JSONObject createPathPointObjectJson(AbstractPathPoint pathPoint, boolean Transform localTransform = new Transform(); if (active && pathPoint!= null){ Vec3 location = pathPoint.getLocation(state); - localTransform.setP(location); + Frame parentFrame = pathPoint.getParentFrame(); + Frame baseFrame = parentFrame.findBaseFrame(); + if (baseFrame.equals(parentFrame)) + localTransform.setP(location); + else { + // transform location to baseFrame as the scene graph for visualization uses it for mobodyindex + Vec3 locationInBaseFrame = parentFrame.findStationLocationInAnotherFrame(state, location, baseFrame); + localTransform.setP(locationInBaseFrame); + } } else localTransform.setP(computedLocation);