-
Hi! I would like to make a line of fluid block constructed by a fluid particles generated from a mobile emitter. By using python scripts, I was able to change the emitter position. However, I could not do it repeatedly. My ultimate goal is to get position data from Gazebo and put the emitter at that position so that it can move in every time frame. Does anyone have tried this before? I am open to any suggestion! |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 7 replies
-
If you take a look at the example "callbacks.py", there is a function "time_step_callback()" which is called after each simulation step. You can try to move the emitter in such a function. |
Beta Was this translation helpful? Give feedback.
-
Hi, @janbender! I have another question. I edited complex_scene.py to linearly move the emitter in x-direction.
The above callback function was not updated to the simulation. How can I fix this? Thank you so much always for your help. |
Beta Was this translation helpful? Give feedback.
-
Hi, This won't work since "scene" just contains the data from the scene file. This is read once at the start of the simulator and then the simulation is initialized. Modifying this data afterwards has no effect. You have to modify the emitter directly. Each FluidModel (you can get it from the Simulation) has an emitter system (fluidModel.getEmitterSystem()). Each emitter system has some emitters (getEmitters()). If you have the emitter, you can call setPosition(). Hope that helps. |
Beta Was this translation helpful? Give feedback.
-
The box around the emitter is a static boundary object. If you not absolutely need it, you could comment out this line: Then it should not be added to the scene. |
Beta Was this translation helpful? Give feedback.
Hi,
This won't work since "scene" just contains the data from the scene file. This is read once at the start of the simulator and then the simulation is initialized. Modifying this data afterwards has no effect.
You have to modify the emitter directly. Each FluidModel (you can get it from the Simulation) has an emitter system (fluidModel.getEmitterSystem()). Each emitter system has some emitters (getEmitters()). If you have the emitter, you can call setPosition().
See also:
https://github.com/InteractiveComputerGraphics/SPlisHSPlasH/blob/master/pySPlisHSPlasH/EmitterModule.cpp#L18
Hope that helps.