Home › Forum › SOFA › Programming with SOFA › [SOLVED] How to define an animation path?
Tagged: 64_bits, Linux_ubuntu, SOFA_1608
- This topic has 3 replies, 3 voices, and was last updated 8 years, 1 month ago by
Anna.
-
AuthorPosts
-
4 June 2017 at 02:11 #9276
Noura
BlockedHi,
I’m looking for a proper way to apply a given animation to an object in a scene.
By examining some provided examples, I noticed that a certain animation of an object is done
– either by applying some gravity force
– or by applying an external force (like interaction with mouse)
– or by doing some configuration in the scene like assigning a constant velocity (according to xyz axis) to the mechanical state of the desired object
in all cases, a solver is required of course.What I’m trying to do is to define a specific animation (moving an object M according to a predefined path).
To this end, I calculate a transformation matrix at each animation step based on some rotations and translations. After that I replace the positions of M at theAnimateBeginEventusing
MO_link.get()->d_positions.setValue(new_vertices_positions);MO_linkis a link to the object in the scene, andnew_vertices_positionsis the positions calculated by applying the transformation matrix.It works, but I would like to know whether this is the good practice since that I have a lot of animation paths to implement.
Could you please comment this way of moving an object? Is there some more efficient way or classes designed for this purpose (I already glimpsed some
MovementConstraintclasses but I doubt that they can be used for the above purpose)? or some recommended examples?Thanks,
Noura
5 June 2017 at 23:09 #9278Noura
Blockedjust to let you know that I looked for another way to do it, and it seems that
applyTranslation,applyRotationdo the task in a simpler way. I think i found the answer to my question above.Noura
8 June 2017 at 21:36 #9305mslib
BlockedThanks, I had also been looking into how to integrate predefined animation in a scene. I am going to try out
applyTranslation,applyRotation.12 October 2017 at 13:07 #10066Anna
BlockedHi @noura,
I actually implemented the same thing using my own component but I then came across collision issues. Indeed, in a simple scene with a deformable object and an moving obstacle, collisions are not handled correctly but they are if my obstacle is fixed.
Did you came across such a problem?
-
AuthorPosts
- You must be logged in to reply to this topic.
