Replies: 2 comments 2 replies
-
Animated bodies are not dynamic bodies, so they are just moved around by animating them but they are not simulated. Therefore, no forces and torques are computed for these bodies since anyway they would not react on a force. Since dynamic bodies use a completely different system (namely the PositionBasedDynamics library), it is not so easy to solve it with a small hack. So either you could try to use dynamic bodies or you could try to extend the code to compute the forces on the boundary particles of an animated body. |
Beta Was this translation helpful? Give feedback.
-
The forces are summed up here: SPlisHSPlasH/SPlisHSPlasH/BoundaryModel.h Line 38 in 4dc7486 The addForce function is called in the pressure solver and other solvers. If you change the "if" commands there, it could work. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi there,
I would like to get force and torque applied to rigid body by fluid.
Thus I call method "GetForceAndTorque" in scene file "\pySPlisHSPlasH\examples\animated_body.py" as following:
def time_step_callback(): sim = sph.Simulation.getCurrent() boundary = sim.getBoundaryModel(1) animatedBody = boundary.getRigidBodyObject() animatedBody.setAngularVelocity([0, 60.0/180.0*math.pi, 0]) animatedBody.animate() # calculate force and torque of fluid to rigid body? f = np.ndarray([3, 1]) t = np.ndarray([3, 1]) boundary.getForceAndTorque(f, t) print("Force: ", f[0], " ", f[1], " ", f[2]) print("Torque: ", t[0], " ", t[1], " ", t[2])
However, I get the values that remain the same as:

which I supposed to be related to fluids.
I wondering whether I call "GetForceAndTorque()" correctly?
Otherwise, how can I get force and torque applied to rigid body by fluid?
Thanks!
——————————————————————————————————————————————————————
Latest:
I have found forces and torques applied to dynamic rigid bodies however, calculating them for an animated rigid body remains an issue.
Rigid bodies with tag "isAnimated = True" seem to contradict calculating force and torque?
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions