- This topic has 1 reply, 2 voices, and was last updated 3 years, 8 months ago by .
Viewing 2 posts - 1 through 2 (of 2 total)
Viewing 2 posts - 1 through 2 (of 2 total)
- You must be logged in to reply to this topic.
Home › Forum › SOFA › Programming with SOFA › How to get the 3d position of mouse interaction in SofaPython
Tagged: Linux_ubuntu, mouse interaction, SOFA_2006
Hi,
I want to use mouse to interact with the object.
How can I get the 3d interaction point (or a closed point) on the object by using python?
Thank you very much!
Hey @baymin,
It is not currently possible. We would need to add python bindings allowing us to call :
BodyPicked point = GUIManager::getGUI()->getViewer()->getPickHandler()->getLastPicked();
This should not be too complicated:
1. Add python bindings for the BaseViewer class, especially the getPickHandler method
2. Add the getViewer() methods to the already existing bindings of BaseGui.
3. Add python bindings for the PickHandler class, especially the getLastPicked() method.
4. Add python bindings for the BodyPicked class, especially these members:
sofa::core::behavior::BaseMechanicalState *mstate;
sofa::Index indexCollisionElement;
defaulttype::Vector3 point;
SReal dist;
SReal rayLength;
It would be a good addition to the SofaPython3 plugin, if you or somebody else is up to the challenge (maybe @hugo has an idea here). I can provide help and guidance without issue.
J-N
WARNING
The forum has been moved to GitHub Discussions.
Old topics and replies are kept here as an archive.