- This topic has 3 replies, 3 voices, and was last updated 7 years, 2 months ago by .
Viewing 4 posts - 1 through 4 (of 4 total)
Viewing 4 posts - 1 through 4 (of 4 total)
- You must be logged in to reply to this topic.
Home › Forum › SOFA › Programming with SOFA › [SOLVED] How to define an animation path?
Tagged: 64_bits, Linux_ubuntu, SOFA_1608
Hi,
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 the AnimateBeginEvent
using
MO_link.get()->d_positions.setValue(new_vertices_positions);
MO_link
is a link to the object in the scene, and new_vertices_positions
is 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 MovementConstraint
classes but I doubt that they can be used for the above purpose)? or some recommended examples?
Thanks,
Noura
just to let you know that I looked for another way to do it, and it seems that applyTranslation,applyRotation
do the task in a simpler way. I think i found the answer to my question above.
Noura
Thanks, I had also been looking into how to integrate predefined animation in a scene. I am going to try out applyTranslation,applyRotation
.
Hi @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?
WARNING
The forum has been moved to GitHub Discussions.
Old topics and replies are kept here as an archive.