Nodes/Avatar Graph/Object Call Ray Cast
ComfyUI Node

Object Call Ray Cast

Object Call Ray Cast — ComfyUI Node from Avatar Graph

By avatechai·Created 3 years ago·Updated 2 years ago· 264
Object Call Ray Cast
  • BPY_OBJ
  • origin
  • direction
  • BPY_OBJ
distance1.70141e+38

Avatar Graph is Avatech AI's pack for turning a single character portrait into a real-time interactive 2D avatar - automatic eye blinks, lip sync - built on Blender's Python engine (bpy) as the mesh backend and Avatech's own "Shape Flow" runtime for driving it live. The README shows off a short, specific list of nodes as the actual product surface: Create Mesh Layer, Create Shape Flow, Avatar Main Output. Object Call Ray Cast isn't in that list, but of everything in the large ObjectCall_* family exposing Blender's bpy.types.Object API node-for-node, this is one of the few where you can actually picture a real use in this pack's own domain - geometric picking is exactly the kind of thing a rig-building or landmark-projection step would need.

object.ray_cast(origin, direction, distance) is Blender's ray-intersection query: cast a ray from origin in direction, in the object's local space, against its evaluated geometry, and get back whether it hit, and if so where. It's the mechanism behind Blender's own click-to-select-a-face tooling, and it's a natural fit for anything that needs to project a 2D point (say, a detected facial landmark) onto a generated 3D mesh to find where on the surface it actually lands - plausible territory for a pipeline that goes from a flat character image to a rigged mesh with eye and mouth regions identified.

Inputs from the schema: BPY_OBJ (optional per the schema, effectively required - wire it in from upstream), origin, a field typed " direction" (leading space, one of this node family's recurring code-gen quirks where a complex Blender type got named after its own field instead of mapped to a real widget), and distance, a genuine FLOAT defaulting to 1.70141e+38 - essentially infinite, Blender's own default cap for the ray so it'll keep going until it hits something unless you deliberately shorten it. origin and " direction" both need values wired in from elsewhere in the graph rather than typed directly, since ComfyUI has no native 3D-vector widget for them here. Output is BPY_OBJ - the same object handle passed through, not the hit location/normal data the underlying Blender call actually returns; like the rest of this family, the node is built for chaining, not for reporting results back into the graph.

Installing it means installing the whole pack. ComfyUI Manager: search "Avatar Graph." Manually: cd ComfyUI/custom_nodes && git clone https://github.com/avatechai/avatar-graph-comfyui, then cd avatar-graph-comfyui && pip install -r requirements.txt, restart. The constraint to actually plan around: bpy needs Python 3.10.x exactly, so the README's suggestion of a dedicated conda create --name comfyui python=3.10 env rather than reusing an existing Flux/SDXL setup is worth following. Restart with --enable-cors-header (--force-fp16 too on macOS) for the live avatar preview.

Troubleshooting: bpy failing to import because ComfyUI's interpreter isn't exactly 3.10.x is the wall you're most likely to hit, and it's a genuinely common, recurring category of pain across Blender-Python-based ComfyUI nodes, not unique to this pack. Skipping --enable-cors-header doesn't stop the graph from running or exporting via Avatar Main Output - it just kills the live preview panel, by design. Since this node has no documentation of its own anywhere in the repo, and since the output here doesn't surface the hit result you'd actually want from a ray cast, Blender's own Object.ray_cast() reference is where you'd go to understand exactly what's being computed under the hood - this node just doesn't hand you the answer directly.

Categoryblender

Inputs (4)

NameTypeDefaultDescription
BPY_OBJoptBPY_OBJ
originoptorigin
directionopt direction
distanceoptFLOAT1.70141e+38

Outputs (1)

NameTypeDescription
BPY_OBJBPY_OBJ