com.sonosthesia.interaction
v1.12.0
Published
Sonosthesia unity interaction
Readme
com.sonosthesia.interaction
Foundational interaction framework for Sonosthesia packages. It defines how sources and actors expose themselves as interaction endpoints, how events gate compatibility, and how affordances consume interaction streams to drive audio, visual, or haptic responses.
Core interaction model
IInteractionEventpairs a source and actor endpoint with timing data and utility extensions for working in shared spaces (positions, distances, velocities). IInteractionEvent.cs ExtractionUtils.csInteractionEndpointimplements the shared endpoint surface (domain, interaction layers, dynamics monitor) that actors and sources inherit to participate in interaction checks. InteractionEndpoint.cs IInteractionEndpoint.cs- Gates and layer matching let affordances filter streams before they start, combining per-endpoint gates with
InteractionLayerMatchrules for coarse compatibility control. InteractionGate.cs InteractionLayerMatch.cs
Affordance pipeline
InteractionAffordance<TEvent>subscribes to channel streams, evaluates gates, and hands off to controllers or relays while keeping logging and relay wiring unified across packages. InteractionAffordance.cs- Specialized affordances build on the base to spawn visuals, drive envelopes, or coordinate schedulers while reusing the same stream lifecycle.
Affordance effects
- Drag: Spawns optional origin/target prefabs and a line renderer per interaction, then keeps their positions updated so streams can visualize drags or pulls between endpoints. DragAffordance.cs DragAffordanceController.cs
- Peak: Uses envelope-driven magnitude, duration, speed, and chaos controls to schedule peak events and broadcast them to a signal target, randomizing values per configuration. PeakAffordance.cs
- Trigger: Wraps an interactive trigger session so affordances can start, update, and end
Trigger.Triggerplayback using shared trigger settings and configuration objects. TriggerAffordance.cs - Torque: Evaluates a torque extractor and intensity envelope to apply torque (relative or world) on a configured rigidbody every fixed update, optionally tracking changes over the stream. TorqueAffordance.cs
- Scheduler: Feeds speed and chaos envelopes into a scheduler session and forwards generated scheduler events to a signal channel for downstream consumers. SchedulerAffordance.cs
- Channel-count: Watches configured channel inputs and notifies subclasses when the aggregate active channel count changes, enabling count-driven effects. ChannelCountAffordance.cs
- Activation: A channel-count implementation that toggles target GameObjects on when any channels are active and off when they are all idle. ActivationChannelCountAffordance.cs
Extractors, triggers, and envelopes
- Extraction utilities provide reusable float and vector extractors (velocity, distance, twist, relative position, axis) plus configurable static/dynamic extractor settings that downstream packages compose for their own event types. ExtractionUtils.cs
- Interactive triggers wrap envelope playback and attack/release extraction so affordances can start, update, and end gestures consistently, whether they are pulses or holds. IInteractiveTriggerSettings.cs InteractiveTriggerSession.cs
- Interactive envelopes mirror the trigger flow for continuous values, supporting bypass or gated playback, optional One Euro filtering, and warpable release envelopes for smooth teardown. InteractiveEnvelopeSession.cs IInteractiveEnvelopeSettings.cs
Dynamic tracking
- Dynamic tracking sessions generate positional targets for moving emitters or falloff handles, from frozen anchors to drag-damped velocity extrapolation using monitored transform dynamics. DynamicTrackingSession.cs DynamicTrackingSettings.cs
Usage in dependent packages
- com.sonosthesia.touch: Uses
InteractionEndpoint-derived touch actors/sources andTouchEventinteraction streams to gate collider contacts and drive touch affordances built on interaction extractors. TouchEvent.cs ATouchSource.cs - com.sonosthesia.collide: Uses
CollideEventinteraction data and interaction-based trigger configurations to convert collision streams into affordance-friendly envelopes and torque/peak drivers. CollideEvent.cs CollideTriggerConfiguration.cs - com.sonosthesia.pointer: Uses
PointerSourceendpoints that publishPointerEventinteraction streams into channels for pointer trigger, scheduler, and drag affordances built on the interaction base class. PointerSource.cs PointerEventChannel.cs - com.sonosthesia.instrument: Uses interaction-affordance controllers and extractor-based MIDI configurations to map interaction events into MIDI notes and control streams. MIDINoteAffordance.cs MIDIExtractorSettings.cs
- com.sonosthesia.fmodinteraction: Uses interactive envelope settings and dynamic tracking from interaction configurations to position FMOD emitters and drive volume/excitation/body curves per event. FMODEmitterConfiguration.cs
- com.sonosthesia.deforminteraction: Uses interaction envelopes and tracking inside mesh noise configurations so touch or collision events modulate falloff, displacement, and speed across deformable surfaces. MeshNoiseConfiguration.cs
- com.sonosthesia.vfx: Uses
VFXEventAffordance<TEvent>to turn interaction streams into VFX Graph event calls with attributes extracted from each interaction payload. VFXEventAffordance.cs - com.sonosthesia.sculpt: Declares the interaction dependency so sculpting tools can share endpoint/gate infrastructure alongside XR interaction components. package.json
