ObjectTrackerBaseBehaviour Class

Inherits: DeviceUserAbstractBehaviour

Description

ObjectTrackerBaseBehaviour is the component to control ObjectTracker in the AR scene.

ObjectTracker is used for 3d object target detection and tracking. ObjectTracker detects and tracks ObjectTarget. You can call StartTrack/StopTrack to enable/disable the track process. StartTrack and StopTrack are very lightweight calls.

ObjectTrackerBaseBehaviour should Bind to a DeviceAbstractBehaviour. This will be automatically done by the ARBuilder if you put ObjectTrackerBaseBehaviour in the scene before everything start. If you add the component later in the scene, make sure to Bind it to a DeviceAbstractBehaviour, for example, Bind to a CameraDeviceBaseBehaviour.

An ObjectTargetBaseBehaviour must be loaded into ObjectTrackerBaseBehaviour before its target can be tracked using LoadObjectTargetBehaviour explicitly or ObjectTargetBaseBehaviour.Bind implicitly.

You will receive TargetAbstractBehaviour.TargetFound / TargetAbstractBehaviour.TargetLost and ARCameraBaseBehaviour.TargetFound / ARCameraBaseBehaviour.TargetLost events when a target is found or lost.

You can get a Frame from ARCameraBaseBehaviour.FrameUpdate which contains current camera image and tracked TargetInstance.

Public Properties

List<ObjectTargetBaseBehaviour> LoadedTargetBehaviours
int SimultaneousNum

Public Functions

void LoadObjectTargetBehaviour(ObjectTargetBaseBehaviour ObjectTargetBaseBehaviour)
void UnloadObjectTargetBehaviour(ObjectTargetBaseBehaviour ObjectTargetBaseBehaviour)
bool StartTrack()
bool StopTrack()

Public Events

event Action<ObjectTrackerBaseBehaviour, ObjectTargetBaseBehaviour, Target, bool> TargetLoad
event Action<ObjectTrackerBaseBehaviour, ObjectTargetBaseBehaviour, Target, bool> TargetUnload

Overwritten MonoBahaviour Functions

protected virtual void OnDestroy()
protected virtual void Start()
protected virtual void Update()

List<ObjectTargetBaseBehaviour> LoadedTargetBehaviours

The ObjectTargetBaseBehaviours currently loaded into the component.

int SimultaneousNum

The max number of targets which will be the simulatneously tracked by the tracker. The default value is 1.

void LoadObjectTargetBehaviour(ObjectTargetBaseBehaviour ObjectTargetBaseBehaviour)

Load the ObjectTargetBaseBehaviour and its target into the component. Use this only if ObjectTargetBaseBehaviour.Bind is not called. See ObjectTargetBaseBehaviour.Bind for more details.

void UnloadObjectTargetBehaviour(ObjectTargetBaseBehaviour ObjectTargetBaseBehaviour)

Unload the ObjectTargetBaseBehaviour and its target from the component.

bool StartTrack()

Starts the track algorithm. The track will start only after the behaviour is Bind to a DeviceAbstractBehaviour. This will be automatically done by the ARBuilder if you put ObjectTrackerBaseBehaviour in the scene before everything start.

bool StopTrack()

Stops the track algorithm. Call StartTrack to start the track again.

event Action<ObjectTrackerBaseBehaviour, ObjectTargetBaseBehaviour, Target, bool> TargetLoad

The event for target load.

event Action<ObjectTrackerBaseBehaviour, ObjectTargetBaseBehaviour, Target, bool> TargetUnload

The event for target unload.