Radial Force dynamic tool
Apply radial forces on dynamics objects using a force field defined by metaballs.
Info
| Compatibility |
Houdini 9.0 |
| Change Log |
Added the Radial Force shelf tool. |
#
# Produced by:
# Graham Thompson
# captainhammy@gmail.com
# www.captainhammy.com
#
# Name: dop_radialforce.shelf
#
# Comments: Creates a radial force that acts on dynamic objects using metaballs.
#
# Version: 1.0
#
# Compatibility: Houdini 9.0
#
import toolutils
import dopgeofiltertoolutils
def magnetValidateGeometry(objnode):
geometry = objnode.displayNode().geometry()
for prim in geometry.prims():
if prim.type() == hou.primType.Metaball:
return
else:
msg = "Selected magnet geometry has no metaballs."
raise hou.OperationFailed(msg)
activepane = toolutils.activePane(kwargs)
if isinstance(activepane, hou.SceneViewer):
magnet = dopgeofiltertoolutils.genericDopGeoForceTool(activepane, 'magnetforce', magnetValidateGeometry,
"magnetforce__radial1",
"Select the dynamic object(s) to apply the radial force to and press Enter to continue.",
"Select the object to drive the radial force and press Enter to continue.")
magnet.parm("forcescale").set(-10000)
magnet.setName("radialforce1", True)