C++ HDK - interact with rigid bodies

   2122   7   3
User Avatar
Member
24 posts
Joined: 4月 2011
Offline
Are there any pointers as two how to approach a coupled solve between a custom SIM_solver derived DOP solver and houdini/bullet rigid bodies.

There is some discussion about it in this older post: https://www.sidefx.com/forum/topic/25444/#post-118354 [www.sidefx.com]

The last paragraph interests me most. I can get to the SIM_Object instances that represent the rigid bodies. But how would I go about applying forces or impulses on them? The SIM_Object does not seem to have an interface for that.

Any help appreciated,

Rog
User Avatar
スタッフ
750 posts
Joined: 10月 2012
Offline
You should create impact data on the objects, which will then be read by the Bullet solver on the next feedback iteration:
SIM_Impacts *impacts = SIM_DATA_CREATE(*obj, SIM_NEWFEEDBACK_DATANAME, SIM_Impacts, SIM_DATA_RETURN_EXISTING);
impacts->addPrimitiveImpact(...)
User Avatar
Member
24 posts
Joined: 4月 2011
Offline
Thanks!!

Trying that now!
User Avatar
Member
24 posts
Joined: 4月 2011
Offline
Great, that works, mostly.

I had to use SIM_FEEDBACK_DATANAME instead of SIM_NEWFEEDBACK_DATANAME for the bullet packed rbd object to react.

Also, as I was debugging this, I noticed that if I combine this test solver (ripped of from the SnowSolver example) that as soon as I merge in a bullet solved packedrbd the solveSingleObjectSubclass function will get called twice per timestep. I double checked that no substepping is on the DOP network node, nor the Bullet Solver node. Is there an obvious explanation for this?

Thanks again,
Rog
User Avatar
スタッフ
750 posts
Joined: 10月 2012
Offline
If you check the current simulation time in the solver, you're likely re-simulating the same timestep again according to the Max Feedback Loops parameter on the DOP network.
User Avatar
Member
24 posts
Joined: 4月 2011
Offline
You are right! It is related to the Max Feedback Loops being 2 and the merge relationship being set to mutual.

I'm afraid to admit that in my 10 years of dopsing around I had never given that parameter much thought.

Is there any more information apart from the normal houdini docs on how to deal with feedback loops? Is there a way of flagging to SIM_engine or as return value that there is no, or no more, interaction? So we can avoid unnecessarily re-simulating?

Sorry if these questions are a bit scattered. The information may be hidden inside the HDK docs but I haven't stumbled across it or put it together.

And thanks for your quick replies so far, really appreciated!

Rog
User Avatar
スタッフ
750 posts
Joined: 10月 2012
Offline
The absence of any feedback subdata will terminate the feedback loop, so just be careful to only create it once there are impacts.
User Avatar
Member
24 posts
Joined: 4月 2011
Offline
Aha, that makes sense!

Thanks
  • Quick Links