Skip to main content

vScriptValPointAttractorSpring

Attracts or repels points with a spring-damper simulation that keeps its speed between frames.

AdvancedMograph / ScriptValScriptValArrayJSON
vScriptValPointAttractorSpring node

vScriptValPointAttractorSpring takes an array of points and runs one simulation step per frame. A spring pulls each point back to its input position, and the attractor pushes points inside Radius. A second output draws the radius as a circle.

Parameters​

ParameterTypeDefaultDescription
Strength (+attract/-repel)Float0.001Force at the attractor. Positive pulls, negative pushes. Slider -0.01 to 0.01, default 0.001.
RadiusFloat1.0Distance within which the attractor acts. Minimum 0.000001, slider 0.001 to 5, default 1.
Falloff PowerFloat1.0Exponent of the falloff. Minimum 0.01, slider 0.01 to 5, default 1.
Spring ReturnFloat0.1Strength of the pull back to the input position. Slider 0 to 1, default 0.1.
Spring BounceFloat0.9Spring Bounce. Scales the damping term inside the spring. Slider 0 to 1, default 0.9.
+11 more parameters
ParameterTypeDefaultDescription
DampingFloat0.9Multiplies the speed each frame. Slider 0 to 1, default 0.9.
CenterPoint—Hidden control. Not read by the code.
Z OffsetFloat0Hidden control. Not read by the code.
Attractor PositionPoint—Attractor position in X and Y, as a point in the viewer. Default 0.5, 0.5, which is 0, 0 in the node.
Attractor ZFloat0.5Attractor position on Z, used with Use 3D Points. Slider -1 to 1, default 0.5.
AxisPoint—Hidden control. Not read by the code.
Relative Flare OffsetFloat1.5Hidden control. Relative Flare Offset. Not read by the code. Default 1.5.
MultiplierFloat1Divides the attractor X and Y. Minimum 0.000001, slider 0 to 2, default 1.
Use 3D PointsFloat1Simulates and outputs Z when on (default). Off gives 2 values per point.
Reset SimulationInteger0.0Button. Restarts the simulation from the input points on the next frame.
InputScriptVal—Data to process.
Read the full description

Each frame, every point gets a spring term toward its input position, (home - position) * Spring Return - speed * Spring Return * Spring Bounce, then, if it is inside Radius of the attractor, a push of Strength * (1 - (distance / Radius) ^ Falloff Power) along the line to the attractor. The speed is multiplied by Damping and added to the position. The speed carries over to the next frame, so points can overshoot.

The simulation restarts from the input points on the first frame, when the frame is not the previous one plus 1, when the point count changes, and when Reset Simulation is pressed. The Falloff Guide output is a circle of 65 points around the attractor at Radius. Defaults are Strength 0.001, Radius 1, Spring Return 0.1, Spring Bounce 0.9 and Damping 0.9.

Example Connections​

vScriptValPointsOnGrid.Output -> vScriptValPointAttractorSpring.ArrayA
vScriptValPointAttractorSpring.Output -> vScriptValCameraProjection.ArrayA
vScriptValCameraProjection.Output -> vScriptValShapeRender.ArrayPoint
Background.Output -> vScriptValShapeRender.Input