Gang:
I’m trying to add a large number of point forces to a RBD object, and would rather do it programmatically than with a bunch of Point Force DOPs … it looks like the Script Solver might be what I’m looking for, but I haven’t gotten it to work yet … any examples floating around? Or is there a better way to tackle this? I considered a VOP Force DOP, but it looks like I’d have to convert my point forces into separate force and torque vectors myself, which I was hoping to avoid. Any thoughts?
Thanks in advance,
Tim
Adding forces to a DOP object programmatically? [[SOLVED]]
666 4 1- tshead
- Member
- 62 posts
- Joined: Sept. 2014
- Offline
- tamte
- Member
- 8595 posts
- Joined: July 2007
- Online
not considering custom VOP/VEX solutions
if you are limited to DOP forces (oldschool RBDs) you can for example use Magnet Force DOP, which can use metaball field, so you can use metaballs copied to your force points
if you can also use POP forces (Bullet) there is similar POP Metaball Force
if you are limited to DOP forces (oldschool RBDs) you can for example use Magnet Force DOP, which can use metaball field, so you can use metaballs copied to your force points
if you can also use POP forces (Bullet) there is similar POP Metaball Force
Edited by tamte - Dec. 28, 2023 03:10:38
Tomas Slancik
FX Supervisor
Method Studios, NY
FX Supervisor
Method Studios, NY
- tshead
- Member
- 62 posts
- Joined: Sept. 2014
- Offline
- tshead
- Member
- 62 posts
- Joined: Sept. 2014
- Offline
Although I didn’t end up going with the Magnet Force DOP or the POP Metaball Force, those were excellent suggestions that taught me quite a bit. In the end, I was able to get the Script Solver working - all that was missing was to wire it and the Bullet solver I’ve been using into a Multiple Solver.
Cheers,
Tim
Cheers,
Tim
Edited by tshead - Dec. 30, 2023 22:22:16
- cncverkstad
- Member
- 119 posts
- Joined: Aug. 2017
- Offline
Just if someone need that ex in Pic + You can Find ex In Houdini Help Files..
def solveForObjects(solver_data, new_dop_objects, existing_dop_objects, time, timestep): # RBD for obj in new_dop_objects: # RBD_Solver # Geometry OBJ with obj.editableGeometry("Geometry") as geo: //set file # Position, t Position = obj.createSubData("Position","RBD_State") Position.options().setField("t",hou.Vector3(obj.objid(),0,0)) Position.options().setField("computecom",1) Position.options().setField("computemass",0) Position.options().setField("inertialtensorstiffness",1) # Gravity obj.createSubData("Forces/Gravity","SIM_ForceGravity") PhysicalParms=obj.createSubData("PhysicalParms","SIM_PhysicalParms") PhysicalParms.options().setField("bounce",1.0) # Colliders colliders=obj.createSubData("Colliders","SIM_ColliderLabel") # Geo OBj if False: objsim=obj.simulation() # Obj # no colide else: objsim = obj.simulation() for obj in existing_dop_objects: # rbdstate=obj.findSubData("Position") t=hou.Vector3(rbdstate.options().field("t")) forcedata=obj.findSubData("Forces/Gravity") forcedata.options().setField("force",t.normalized()*-0.6) vel=hou.Vector3(rbdstate.options().field("vel")) vel=min(2,vel.length())*vel.normalized() rbdstate.options().setField("vel",vel) angvel=hou.Vector3(rbdstate.options().field("angvel")) angvel[2]=hou.hmath.clamp(angvel[2],-180,180) rbdstate.options().setField("angvel", angvel)
Conservation of Momentum
-
- Quick Links