Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

ProtoFlux:FieldHook

From Resonite Wiki
Revision as of 13:44, 28 January 2026 by Electra (talk | contribs) (Added notes on usage and an example, as well as a link to an example world.)
Field Hook
StartDrive
OnStartDrive
StopDrive
OnStopDrive
Target
OnHook
Source
IsDriving
HookedValue
Core

The Field Hook node takes in a target field and the source field value, then returns if this field is driving, as well as allowing the user to start and stop driving this field. This node gives the user more control to programmatically drive fields directly using ProtoFlux. This node hooks the given field, so whenever something external tries to write to it, it will receive a pulse from OnHook as well as the value it tried to write from HookedValue.

Manually unlinking the drive in an inspector behaves the same as triggering StopDrive.

Inputs

StartDrive (Call)

Calls an impulse to start driving the target (hooking into it).

StopDrive (Call)

Calls an impulse to stop driving the target (unhooking it).

Target (IField`1)

The target field to drive.

Source (Generic)

The source to drive Target from. While active this acts like any other drive.

Outputs

OnStartDrive (Continuation)

Fires when we started driving the target field.

OnStopDrive (Continuation)

Fires when we stopped driving the target field.

OnHook (Call)

Fires when something writes to the target field while it is being driven by this node.

IsDriving (bool)

Returns if the target field is being driven.

HookedValue (Generic)

Returns the value that was written by the OnHook call.


Examples

The example saves the current position of the cube on loading so it can will return to that spot 5 seconds after being moved.

It stores the inital position in a DataModel Store as well as triggering StartDrive. When the cube is moved, it uses the OnHook impulse to write HookedValue to a DataModel Store connected to Source, allowing the cube to behave like normal. And 5 seconds latter overwrites this with the initial position. When saving the cube, OnSave triggers StopDrive so to the cube is ready for next time.

resrec:///U-1cLc1qmP4CG/R-fcdb06e2-dfb2-475c-9161-6c2169720704

A much more advanced set of practical examples can be found in "Swangin' Doors" by Baxer:https://go.resonite.com/record/U-Baxter/R-f8cf3c37-d4bb-4d9d-a19b-227790c19af5