opensim-core
opensim-core copied to clipboard
Fix `Marker` does not render in the correct location when attached to a `PhysicalOffsetFrame`
Because it doesn't apply the correct transform w.r.t. the base frame.
The code for doing it is there, but commented out:
- https://github.com/opensim-org/opensim-core/blob/main/OpenSim/Simulation/Model/Marker.cpp#L173
Is it commented out for a GUI-related reason or similar, if you know @aymanhab (I think you last touched it, around Sep 2016 - there's a bunch of issues related to adding Frame
s around then, so I imagine it's related to that?)
Totally fresh in my mind being about 8 yrs ago ;) I'll try to dig through the logs to reconstruct.
I mean, I'm happy to patch it back in but I noticed that it's commented out and figured "hm, there might be some non-obvious reason why it'd be a bad idea to compute the marker decoration that way"
If I'm reading the log correctly the commented lines were removed because the results were unused. Not sure if they were ever used. Bottom line is that generateDecorations creates decoration primitives relative to some frame (MobilizedBodyIndex). This is used by the GUI as well as the API visualizer to easily move MobilizedBodies by obtaining/updating one transform and then all decorations fixed to this MobilizedBody go along for the ride. If you need to refactor this code to make it work for the new frame that's perfectly fine as long as you keep the above/existing setup working.
Thanks for looking into it! I'll try and patch it in a PR