Table of Contents
- Zinnia
- Action
- Association
- Cast
- Data
- Attribute
- Collection
- Counter
- List
- ObservableList api
- BehaviourObservableList api
- DefaultObservableList api
- FloatObservableList api
- GameObjectObservableList api
- GameObjectRelationObservableList api
- SerializableTypeBehaviourObservableList api
- SerializableTypeComponentObservableList api
- StringObservableList api
- UnityObjectObservableList api
- Vector2ObservableList api
- Vector3ObservableList api
- Stack
- Enum
- Operation
- Extraction
- GameObjectExtractor api
- ComponentGameObjectExtractor api
- SurfaceDataCollisionPointExtractor api
- TransformDataGameObjectExtractor api
- TransformDirectionExtractor api
- TransformEulerRotationExtractor api
- TransformPositionExtractor api
- TransformPropertyExtractor api
- TransformScaleExtractor api
- Vector2ComponentExtractor api
- Vector3Extractor api
- Mutation
- GameObjectCloner
- Extraction
- Type
- Event
- Extension
- Haptics
- Pointer
- Process
- Rule
- Tracking
- CameraRig
- Collision
- Follow
- Modification
- Query
- Velocity
- SurfaceLocator api
- Utility
- Visual
Zinnia
This page is community documentation for Zinnia.Unity, a package in the VRTK family.
The generated API documentation can be found here.
Action
Actions have two primary functions:
- Receive values
- Emit values
There are a few ways an action can recieve values:
- Its
Receive()
method. - An Action in its
Sources
list.
When an Action receives a value, it also emits it.
If an Action is a source for any other Action, values will be propagated along.
Each Action has a number of Unity Events as well:
- Activated
- Deactivated
- Activation State Changed
- Value Changed
By using the Value Changed event, you can respond to an Action's value in basically any way needed.
Collection
Scripts for observing lists of action related types.
ActionObservableList api
Maintains a list of Zinnia Actions and emits events when that list is changed.
ActionRegistrarSourceObservableList api
Maintains a list of ActionRegistrar.ActionSource instances and emits events when that list changes.
Action api
Base class for all Action types.
Each action has a data-type, like float or GameObject.
- Sources: A list of other Actions which this Action listens to.
- UnityEvents:
- Activation State Changed
- Activated
- Value Changed
- Deactivated
AllAction api
Action that emits a boolean when all the given actions are `Action.IsActivated`.
- Actions: ActionObservableList of actions which all need to be activated.
AnyAction api
Action that emits a boolean when any of the given actions are `Action.IsActivated`.
- Actions: ActionObservableList of actions any of which need to be activated.
BooleanAction api
Action that receives and emits booleans.
FloatAction api
Action that receives and emits floats.
StateEmitter api
An IProcessable which causes an Action to re-emit it's last value each time the process is run.
SurfaceChangeAction api
Action that receives a SurfaceData current and emits when the current and previous positions exceed the specified distance.
ToggleAction api
Alternates between emitting its Activated and Deactivated events each time Recieve is called.
Vector2Action api
Action that recieves and emits Vector2 values.
ActionRegistrar api
Sets the sources of a target Action based on a list of other Actions.
The sources of an ActionRegistar are of type `ActionSource` which are a Action/GameObject pair. The GameObject is the one that contains the Action.
The ActionRegistrar also maintains a list of GameObjects called the `SourceLimits`. This is basically a filter. Only the ActionSources that have a GameObject in this list are actually added as sources to the target Action.
- Target: The Action whos sources will be set.
- Sources: A list of ActionSources who's Actions will be set as the sources on the Target action.
- SourceLimits: A list of GameObjects denoting valid parent GameObjects.
Association
Associations create a relation between some condition and the state of items in a collection.
That is to say, some aspect of some collection of items, is determined by some condition.
The only case right now is GameObjectsAssociation which relates whether a collection of GameObjects are (in)active based on some condition.
Collection
GameObjectsAssociationObservableList api
An observable list of GameObjectsAssociation instances.
GameObjectsAssociation api
Abstract class which references a GameObjectObservableList of objects to (de)activate based on abstract boolean method `ShouldBeActive`.
GameObjectsAssociationActivator api
An IProcessable which applies the action of a list of GameObjectsAssociation causing their associated GameObjects to be (de)activated accordingly.
LoadedXrDeviceAssociation api
(De)activates GameObjects based on whether the currently loaded XR device name matches the `XrDeviceNamePattern` regular expression.
- XrDeviceNamePattern: Regular expression to match XR device names.
Cast
Behaviours which perform raycasts.
Collection
Mutation
PointsCastPropertyMutator api
Mutates the properties of a target PointsCast.
A GameObject maybe set as the `Target` using the `SetTarget` method which will search for the PointsCast as either a direct, descendant, or ancestor.
PhysicsCast api
A MonoBehaviour which allows for customizing the settings of a Raycast at edit time in the inspector. This can be used by the various casting components.
PointsCast api
Abstract IProcessable for casting components that result in points along the cast.
Each subclass must implement the `DoCastPoints` method. Hits are filtered through the `TargetValidity` rule.
- Origin: Starting point of the cast.
- PhysicsCast: An optional PhysicsCast to configure the raycast.
- TargetValidity: RuleContainer controlling which hits are valid.
- DestinationPointOverride: Override the destination location point in world space.
- TargetHit: `RaycastHit` of the latest hit, or null.
- IsTargetHitValid: Whether the latest `TargetHit` is valid based on `TargetValidity` rule.
- Points: The points along the most recent cast.
- EventData: The EventData for the latest cast.
EventData api
Holds data about a PointsCast event.
- HitData: `RaycastHit?` The result of the most recent cast. `null` when it didn't hit anything.
- IsValid: Whether most recent HitData is valid based on the TargetValidity rule.
- Points: Vector3 points along the most recent cast.
FixedLineCast api
A StraightLineCast except that it only checks for hits at the end of the limited-distance raycast. If no hit is detected, the second point returned is `null`.
StraightLineCast api
A PointsCast which performs a raycast from an origin and direction to a maximum distance. It returns two points. The first point is the origin. The second point is either the maximum position of the line, or the location of any collider hit along the way.
ParabolicLineCast api
A PointsCast which returns the points at the origin, target, and a parabolic arc of points in between.
Data
Attribute
These attributes are used by other Zinnia components to customize their inspector interface. You probably wont need to use these yourself.
CustomInspectorTextAttribute api
Allows for specifing custom text in Zinnia component inspectors.
MinMaxRangeAttribute api
Allows for defining a min and max range for float fields in Zinnia component inspectors.
RestrictedAttribute api
Allows for making fields non-editable in Zinnia component inspectors.
TypePickerAttribute api
Allow for displaying pickers for `Zinnia.Data.Type.SerializableType` fields in Zinnia component inspectors.
Collection
Counter
ObservableCounter api
Allows counting the amount of attempts an element is added or removed from a Dictionary.
You can IncreaseCount(element)
to increase the count.
You can DecreaseCount(element)
to decrease it.
RemoveFromCount(element)
will remove it completely.
And Clear()
will remove all entries.
Being an observable it also features a number of events you can respond to:
- Added: when an element is added for the first time
- Removed: when an element is removed completely
GameObjectObservableCounter api
A ObservableCounter for GameObjects.
List
ObservableList based components that hold a list of objects of a certain type.
ObservableList api
Holds a list of objects of a given type and has a number of events for responding when that list changes.
You can Add(element)
or Remove(element)
add and remove
items. Many methods have "Unique" version, like
AddUnique(element)
to prevent duplication. Check the API
documentation for the full method listing.
It has a CurrentIndex
which you can use for stuff. It gets
clamped based on how many items there are. Most methods that
take an index will similarly clamp it.
The items in the list can be accessed via SubscribableElements
and NonSubscribableElements
depending on whether you care to
keep track item membership on the items themselves. You probably
just want SubscribableElements
.
Use Contains
to check if an item is in the list.
There are a number of events you can subscribe to such ass
Added
, Removed
, Emptied
and so on. Check the API docs for
the full listing.
BehaviourObservableList api
An ObservableList that holds Behaviour
-based types.
DefaultObservableList api
An intermediate class between ObservableList and the type specific classes to prevent some duplicate code. You probably don't need to use this directly.
FloatObservableList api
An ObservableList that holds float
values.
GameObjectObservableList api
An ObservableList that holds GameObject references.
GameObjectRelationObservableList api
An ObservableList that holds GameObjectRelationObservableList.Relation
values.
A Relation
is a type with two GameObject fields:
Key
, a GameObjectValue
, a GameObject
SerializableTypeBehaviourObservableList api
SerializableTypeComponentObservableList api
StringObservableList api
An ObservableList that holds string
values.
UnityObjectObservableList api
An ObservableList that holds UnityObject
references.
Vector2ObservableList api
An ObservableList that holds Vector2
values.
Vector3ObservableList api
An ObservableList that holds Vector3
values.
Stack
ObservableStack api
Holds a stack of objects of a given type and has a number of events for responding when that stack changes.
You can Push(element)
or Pop()
elements.
You can get the items in the stack with the Stack
property.
There are a number of events you can listen to such Pushed
,
Popped
and others. Check the API docs for a full reference.
GameObjectObservableStack api
An ObservableStack that holds GameObject references.
Enum
TransformProperties
A simple enum denoting Position
, Rotation
or Scale
.
Operation
Extraction
Extraction components return a specific piece of data from a referenced object.
GameObjectExtractor api
Abstract class for extractors returning GameObjects.
ComponentGameObjectExtractor api
SurfaceDataCollisionPointExtractor api
TransformDataGameObjectExtractor api
TransformDirectionExtractor api
TransformEulerRotationExtractor api
TransformPositionExtractor api
TransformPropertyExtractor api
TransformScaleExtractor api
Vector2ComponentExtractor api
Vector3Extractor api
Mutation
RigidbodyPropertyMutator api
TransformEulerRotationMutator api
TransformPositionMutator api
TransformPropertyMutator api
TransformScaleMutator api
GameObjectCloner
Produces clones of a GameObject.
Set Source
to the GameObject to clone and optionally specify a
Parent
to add clones under. Calling Clone()
will clone
Source
or you can clone any GameObject by calling
Clone(source)
.
A single event is raised Cloned
.
Type
Transformation
Aggregation
Conversion
FloatRangeValueRemapper api
Transformer api
Vector3MagnitudeSetter api
Vector3Restrictor api
FloatRange
HeapAllocationFreeReadOnlyList
SerializableType api
SurfaceData api
TransformData api
Vector3State
Event
Proxy
EmptyEventProxyEmitter api
EventProxyEmitter api
FloatEventProxyEmitter api
GameObjectEventProxyEmitter api
RestrictableSingleEventProxyEmitter api
SingleEventProxyEmitter api
SurfaceDataProxyEmitter api
TransformDataProxyEmitter api
BehaviourEnabledObserver api
Extension
ArraySortExtensions api
BehaviourExtensions api
ColliderExtensions api
ComponentExtensions api
FloatExtensions api
GameObjectExtensions api
IReadOnlyCollectionExtensions api
RuleContainerExtensions api
TransformDataExtensions api
TransformExtensions api
Vector2Extensions api
Vector3Extensions api
Haptics
Collection
HapticProcessObservableList api
AudioClipHapticPulser api
AudioSourceHapticPulser api
HapticProcess api
HapticProcessor api
HapticPulser api
RoutineHapticPulser api
TimedHapticPulser
XRNodeHapticPulser api
Pointer
Operation
Mutation
PointerElementPropertyMutator api
ObjectPointer api
PointerElement api
Process
Component
GameObjectSourceTargetProcessor api
SourceTargetProcessor api
Moment
Collection
MomentProcessObservableList api
CompositeProcess api
MomentProcess api
MomentProcessor api
EventProcess api
IProcessable api
ProcessContainer api
Rule
Collection
RuleContainerObservableList api
RulesMatcherElementObservableList api
ActiveInHierarchyRule api
AllRule api
AnyBehaviourEnabledRule api
AnyComponentTypeRule api
AnyLayerRule api
AnyRule api
AnyTagRule api
GameObjectRule api
IRule api
ListContainsRule api
NegationRule api
Rule api
RuleContainer api
RulesMatcher api
Tracking
CameraRig
Collection
LinkedAliasAssociationCollectionObservableList api
Operation
Extraction
LinkedAliasAssociationCollection api
Collision
Active
There are a number of classes that coordinate active collision tracking:
- CollisionNotifier: Emits events related to collisions.
- CollisionNotifier.EventData: Holds information related to collisions.
- ActiveCollisionsContainer: Holds a collection of current collisions raised by a CollisionNotifier.
- ActiveCollisionPublisher: Sends collision information to the things involved in collisions.
- ActiveCollisionConsumer: Receives collision information when involved in collisions.
These classes attempt to communicate data about collisions between an ActiveCollisionPublisher and any number of ActiveCollisionConsumers.
When collisions take place, a CollisionNotifier's events can be configured to add the associated CollisionNotifier.EventData to an ActiveCollisionsContainer.
When an ActiveCollisionPublisher publishes, it searches all of the objects that own colliders being tracked by the ActiveCollisionsContainer for ActiveCollisionConsumer components which it will pass collision data to.
Event
Operation
ActiveCollisionConsumer api
Objects involved in collisions that feature this component will recieve information about those collisions from a related ActiveCollisionPublisher.
ActiveCollisionPublisher api
Publishes itself, and relevant collision information, to any ActiveCollisionConsumer components found on objects within a related ActiveCollisionsContainer.
ActiveCollisionsContainer api
Holds a collection of current collisions raised by a CollisionNotifier.
CollisionPointContainer api
Event
Proxy
CollisionIgnorer api
CollisionNotifier api
Recieves and propagates local collision events via Unity Events. The events are propagated as CollisionNotifier.EventData instances.
CollisionNotifier.EventData
Contains information about a collision:
IsTrigger
whether the collider was set toisTrigger
.CollisionData
the Unity collision event data.ColliderData
the Collider that was involved.