Nodes/Avatar Graph/Object Forcefield Toggle
ComfyUI Node

Object Forcefield Toggle

Turning any object into (or out of) a force field

By avatechai·Created 3 years ago·Updated 2 years ago· 264
Object Forcefield Toggle
  • BPY_OBJ
  • BPY_OBJ

Different from Object_EffectorAdd, and worth distinguishing clearly: that node creates a brand-new Empty dedicated to being a force field. Object Forcefield Toggle does the opposite kind of thing - it flips force-field behavior on or off for an object you already have, mesh or otherwise, without creating anything new.

How it works

It wraps bpy.ops.object.forcefield_toggle() - the quick on/off switch behind Blender's Physics properties "Force Field" setting, without needing to go into that panel manually. Since it's a toggle with no type parameter exposed, calling it just flips the object's current on/off state; it doesn't let you pick which kind of field (wind, vortex, magnet, and so on) it becomes. If you need a specific field type, that still has to be set through the object's physics settings some other way, or you'd want Object_EffectorAdd's dedicated type parameter instead if a brand-new Empty is an acceptable approach.

Like this pack's other physics- and simulation-adjacent nodes, this one isn't part of Avatar Graph's documented blink-and-lipsync pipeline - it's general Blender scene-building functionality that got included because the pack auto-generates a node for a wide swath of Blender's object.* operators.

The inputs and outputs that matter

There's exactly one input:

  • BPY_OBJ - the object to toggle force-field behavior on.

Output is a single BPY_OBJ, passed through with its physics state flipped.

How to install it

ComfyUI Manager: search "Avatar Graph", install, restart - or manually:

cd ComfyUI/custom_nodes
git clone https://github.com/avatechai/avatar-graph-comfyui
cd avatar-graph-comfyui && python -m pip install -r requirements.txt

bpy only ships for Python 3.10.x. Windows gets a prebuilt Python-3.10 ComfyUI zip from the README; macOS/Linux wants a dedicated conda create --name comfyui python=3.10 environment rather than an existing newer-Python setup. Add --enable-cors-header on restart (--force-fp16 too on Mac) for the live avatar preview; without it you still get full functionality via .glb/.gltf export.

Common issues & troubleshooting

Node not loading traces to the Python-version pin - check ComfyUI's startup console for a bpy import error first.

Toggled it and nothing seems different - expected, on its own. Force-field status only matters to objects and simulations actually set up to respond to physics forces; toggling it on an ordinary mesh with no particles, cloth, or soft-body setup nearby produces no visible change by itself.

Toggled twice and it's back to where it started - that's the toggle behavior working correctly, not a bug. If your graph calls this node more than once on the same object across different runs or branches, track how many times it's actually fired; an even number of calls cancels out.

Wanted a specific field type, got whatever the default is - this node can only turn the setting on or off, not choose which kind of field it becomes. For explicit control over field type from the start, Object_EffectorAdd is the node with a real type parameter, at the cost of always creating a new object rather than modifying an existing one.

Categoryblender

Inputs (1)

NameTypeDefaultDescription
BPY_OBJoptBPY_OBJ

Outputs (1)

NameTypeDescription
BPY_OBJBPY_OBJ