Nodes/RyanOnTheInside/Proximity Feature Node βš‘πŸ…‘πŸ…žπŸ…£πŸ…˜
ComfyUI Node

Proximity Feature Node βš‘πŸ…‘πŸ…žπŸ…£πŸ…˜

Turn distance between two points into a reactive signal

By ryanontheinsideΒ·Created 2 years agoΒ·Updated 5 months agoΒ· 852
Proximity Feature Node βš‘πŸ…‘πŸ…žπŸ…£πŸ…˜
  • anchor_locations
  • query_locations
  • proximity_feature
β—„extraction_methodβ–Ύβ–Ί
β—„frame_rate30.0β–Ί
β—„frame_count30β–Ί
β—„width512β–Ί
β—„height512β–Ί
β—„normalization_methodβ–Ύβ–Ί

Most of this pack's Feature sources react to audio or motion; this one reacts to distance. Give it two tracked points - an anchor and a query - and it outputs a FEATURE that tracks how close or far apart they are, frame by frame. A hand approaching a face, an object entering a target zone, two dancers moving apart and back together - anything where "how close is X to Y" is the thing you want driving an effect.

How it works

anchor_locations and query_locations both take a LOCATION - this pack's own coordinate type, produced by nodes like LocationFromMask (reads a position off a mask's centroid or boundary) or LocationFromPoint (manually-typed coordinates) elsewhere in the same package. Neither input takes a raw coordinate pair directly; you need an actual LOCATION-producing node upstream first.

normalization_method decides how the raw distance gets scaled into a usable FEATURE value: frame normalizes each frame independently, while minmax normalizes across the whole sequence's observed distance range. Practically, minmax gives you consistent scaling across an entire clip (the closest approach in the whole video reads as the feature's minimum, the farthest as its maximum), while frame judges each frame on its own - pick whichever fits how you want the "closeness" scale to behave over your specific sequence. There's also an extraction_method field on this node for how the raw per-frame distance gets folded into the final feature value; the schema's own tooltip only says "method used to extract features," so treat it as one more thing to try both settings on rather than something with a documented right answer.

The inputs and outputs that matter

  • anchor_locations / query_locations (required, LOCATION) - from LocationFromMask, LocationFromPoint, or another source in the pack.
  • normalization_method - frame (per-frame scaling) or minmax (whole-sequence scaling).
  • extraction_method - how raw distance becomes the final feature value.
  • frame_rate, width/height - standard feature-tensor sizing.

Output is a single proximity_feature (FEATURE) - wire it into any Flex target, FeatureToMask, or ProximityVisualizer to check it visually before trusting it.

How to install it

ComfyUI Manager: search "RyanOnTheInside", install, restart. Manually:

cd ComfyUI/custom_nodes
git clone https://github.com/ryanontheinside/ComfyUI_RyanOnTheInside
cd ComfyUI_RyanOnTheInside
pip install -r requirements.txt

then restart. No model download - this is coordinate math on data another node in the pack already produced.

Common issues & troubleshooting

Node errors immediately, or won't run. anchor_locations and query_locations are both required and both strictly LOCATION type - they don't accept a generic coordinate, an image, or a mask directly. Trace back to confirm a real LocationFromMask/LocationFromPoint node is actually feeding both inputs.

Feature curve looks wrong or inverted. Try switching normalization_method between frame and minmax - with only a whole-sequence view versus a per-frame view to choose from, one of the two usually matches your intuition for "closer means higher value" better than the other, depending on how much the distance range varies across your clip.

Distance readings jump around erratically. If either LOCATION source is derived from a mask (LocationFromMask), a noisy or flickering mask upstream - common with auto-generated segmentation on video - produces a noisy location, which shows up here as an erratic proximity reading. Clean up the mask upstream before troubleshooting this node.

CategoryRyanOnTheInside/FlexFeatures/Sources/Proximity

Inputs (8)

NameTypeDefaultDescription
extraction_methodCOMBOMethod used to extract features
frame_rateFLOAT30.01–120Frame rate of the video (1.0 to 120.0 fps)
frame_countINT301–999999Total number of frames (minimum: 1)
widthINT51264–4096Width of the output feature (64 to 4096)
heightINT51264–4096Height of the output feature (64 to 4096)
anchor_locationsLOCATIONReference locations for proximity calculation
query_locationsLOCATIONLocations to calculate proximity from anchors
normalization_methodCOMBOMethod to normalize proximity values ('frame' or 'minmax')

Outputs (1)

NameTypeDescription
proximity_featureFEATUREβ€”