- This topic has 1 reply, 2 voices, and was last updated 6 years, 10 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 › [SOLVED] What is the appropriate way to perform actions at the simulation steps ?
Tagged: 64_bits, Linux_ubuntu, SOFA_1608
Hi,
The purpose of my question is to get some enlightening how to perform some actions during the simulation, and whether I’m doing it in a proper way.
Having some actions to be performed at each animation step, the AnimateBeginEvent
event can be used.
To this end, I write a class which inherits from BaseController
because the later inherits from BaseObject
which owns the virtual method virtual void handleEvent( Event* )
. Then, I cast the Event*
to one of [Animate/Collision/Integrate][Begin/End]Event
, and I reimplement the event handler in my sub-class component where I place the desired actions. Afterwards, I place the component in the simulation scene file at the top level node or I repeat it inside the sub nodes.
Is this an appropriate way? Could you enlighten me please?
Noura
Hi Noura,
This is indeed the appropriate way.
Do not forget to set the parameter f_listening
at true, this enables to listen to all events.
Cheers,
Hugo
WARNING
The forum has been moved to GitHub Discussions.
Old topics and replies are kept here as an archive.