Forum Replies Created
-
AuthorPosts
-
1 December 2016 at 11:20 in reply to: [SOLVED] Modify fields of a node components (such as translation/rotation) from C++ API. #8035ArcadiaBlurBlocked
Hello,
Thank you very much for your answer. The problem is that maybe I have to access the MechanicalObject rather than the mesh itself. However, I tackled the problem differently by changing the parameters via parsing the scene file. Not that clean and elegant but it works wonders.
Now I’m having issues by finding the translation (I want to align the mesh in a given direction). Will open another thread commenting the issue should it interest other users.
Best,
Albert.24 November 2016 at 11:40 in reply to: [SOLVED] Modify fields of a node components (such as translation/rotation) from C++ API. #7972ArcadiaBlurBlockedHello Hugo,
Thank you very much for your answer!. I have tried something very similar to your code but I haven’t had success so far. The problem is that I cannot access the OglModel directly (does not find the sofa::component). What I do is then create a BaseObject using the getObject method of the node. Then I get the visual model by casting and apply a translation (Visual Model has a method for that).
However, nothing changes in the simulation when doing that. Maybe it is a reference problem or casting issues. Please find the code attached here:
sofa::simulation::Node::SPtr ImplantNode = SOFASimulation->GetRoot()->getChild("Implant"); sofa::core::objectmodel::BaseObject *object = ImplantNode->getObject("oglModel6"); sofa::core::visual::VisualModel* visualModel = dynamic_cast<sofa::core::visual::VisualModel*>(object); visualModel->applyTranslation(100, 0, 100);
-
AuthorPosts