Home › Forum › SOFA › Using SOFA › [SOLVED] How can I add a mesh in SOFA?
Tagged: 32_bits, articulated object, Articulation, Linux_ubuntu, loader, Mesh, SOFA_1503
- This topic has 4 replies, 2 voices, and was last updated 7 years, 12 months ago by luibass92.
-
AuthorPosts
-
20 November 2016 at 13:30 #7788luibass92Blocked
Hi everyone,
In my scene I have an articulated object (/src/examples/Components/mapping/ArticulatedSystemMapping.scn) composed by 4 cuboids linked through some articulations.
I was wondering how can I have some meshes (of which I have the .obj files) instead of that cuboids to link the articulations.I hope that someone can help me.
Cheers.24 November 2016 at 00:08 #7953HugoKeymasterHi Luigi,
What you want to do is to load a mesh ?
The cuboid is generated in the .scn file by :<Node name="Visu"> <OglModel name="Visual" position="-1 -0.5 -0.5 -1 0.5 -0.5 -1 0.5 0.5 -1 -0.5 0.5 1 -0.5 -0.5 1 0.5 -0.5 1 0.5 0.5 1 -0.5 0.5 -1 -0.5 -0.5 -1 0.5 -0.5 -1 0.5 0.5 -1 -0.5 0.5 1 -0.5 -0.5 1 0.5 -0.5 1 0.5 0.5 1 -0.5 0.5 -1 -0.5 -0.5 -1 0.5 -0.5 -1 0.5 0.5 -1 -0.5 0.5 1 -0.5 -0.5 1 0.5 -0.5 1 0.5 0.5 1 -0.5 0.5 -1 -0.5 -0.5 -1 0.5 -0.5 -1 0.5 0.5 -1 -0.5 0.5 1 -0.5 -0.5 1 0.5 -0.5 1 0.5 0.5 1 -0.5 0.5" triangles="3 1 0 3 2 1 3 6 2 3 7 6 7 5 6 7 4 5 4 1 5 4 0 1 5 1 2 2 6 5 4 7 3 4 3 0 11 9 8 11 10 9 11 14 10 11 15 14 15 13 14 15 12 13 12 9 13 12 8 9 13 9 10 10 14 13 12 15 11 12 11 8 19 17 16 19 18 17 19 22 18 19 23 22 23 21 22 23 20 21 20 17 21 20 16 17 21 17 18 18 22 21 20 23 19 20 19 16 27 25 24 27 26 25 27 30 26 27 31 30 31 29 30 31 28 29 28 25 29 28 24 25 29 25 26 26 30 29 28 31 27 28 27 24" /> <RigidMapping template="Rigid3d,ExtVec3f" rigidIndexPerPoint="0 8 8 8 8" input="@.." output="@Visual" /> </Node>
To replace the cuboid, all you need to do is to set the mesh you want to visualize in the field filename of the OglModel:
<OglModel name="VisualModel" fileMesh="path_to/my_mesh.obj"/>
and taking care of the rigidIndexPerPoint parameter in the RigidMapping.
Hope this helps,Cheers,
Hugo
24 November 2016 at 10:14 #7964luibass92BlockedThanks for your reply Hugo,
I’ve already solved the problem replacing the “Collision” and “Visu” nodes with the following:
<Node name="Collision"> <MeshObjLoader name="MeshLoader" filename="mesh/base10.obj" scale="100" translation="0 -3 0" rotation="0 0 0"/> <Mesh src="@MeshLoader" /> <MechanicalObject template="Vec3d" src="@MeshLoader" /> <TriangleModel /> <LineModel /> <RigidMapping input="@.." index="0" /> </Node> <Node name="Visu"> <OglModel name="Visual" filename="mesh/base10.obj" scale="100" translation="0 -3 0" rotation="0 0 0"/> <RigidMapping template="Rigid3d,ExtVec3f" input="@.." index="0" output="@Visual" /> </Node>
It worked fine.
Do you know if it is possible to not check collisions between certain parts of the scene?
I’ve created a robotic hand in SOFA made by 5 articulated chains (one for each finger) with all the relative meshes. The problem is that the collision checking algorithm makes the simulation really slow even if I don’t need to check the collisions between one finger and another or between the parts of a single finger, but just with other objects in the scene.
Thanks for your support,
Luigi
24 November 2016 at 10:55 #7968HugoKeymasterNice to hear Luigi.
About the collision detection: something easy is just to remove the collision model of some parts (here removing
and ).
But what you seem to target is more a specific CollisionPipeline. I think you will have to implement some new pipeline or new collisionListener. Maybe something already exists, I am no expert of collision.I set the topic as solved, since the problem of mesh is solved.
Do not hesitate to create a new topic for any further question.24 November 2016 at 10:57 #7969luibass92BlockedOK, thanks, I will create another topic about collisions
-
AuthorPosts
- You must be logged in to reply to this topic.