Class Leap::Unity::Interaction::ActivityManager

class Leap.Unity.Interaction.ActivityManager<T>

ActivityManager is a wrapper around PhysX sphere queries for arbitrary Unity objects. “Active” objects are objects found in the latest query. It’s also possible to get the sets of objects that just began or stopped being active since the last query; this requires enabling the trackStateChanges setting.

Public Members

float activationRadius

The radius of the query in world-space.

int activationLayerMask = ~0

The layer mask against which to query for active objects. The ActivityManager will only find objects in these layers. By default, the ActivityManager will query all layers, but this is highly inefficient.

See SingleLayer and use bitwise operations on their layerMasks for a convenient way to express layer masks. SingleLayer

Func<int> activationLayerFunction = null

This function, if set to a non-null value, overrides the activationLayerMask setting with the result of calling the function. Use this if your application state will modify the layer mask to use for the activity manager.

Func<Collider, T> filter = null

This is the function by which the ActivityManager converts the Colliders it finds through PhysX queries into Ts to be placed in the ActiveObjects set.

Only objects with at least one Collider for which this function returns a non-null T will be added to the ActiveObjects set.

bool trackStateChanges = false

If set to true, BeganActive and EndedActive will be calculated and populated every time a new query occurs.

Properties

HashSet<T> ActiveObjects { get; set; }

Returns the currently “active” objects objects that were within the latest sphere query.

HashSet<T> BeganActive { get; set; }

If trackStateChanges is enabled (on by default), contains the objects that just started being active since the last query.

HashSet<T> EndedActive { get; set; }

If trackStateChanges is enabled (on by default), contains the objects that just stopped being active since the last query.