Vizard 7 » Reference » Proximity Sensors » vizproximity manager
7.7

vizproximity manager

A proximity manager manages a collection of sensors and targets and automatically triggers events when a target enters/exits a sensor range. The following command creates a Manager object:

Command

Description

vizproximity.Manager(priority=viz.PRIORITY_LINKS + 1)

Creates a Manager object. Can optionally specify the update priority of the manager, which defaults to updating just after links.

The following methods can be called on the Manager object:

Method

Description

<Manager>.addSensor(sensor)

Add a proximity sensor to the manager.

<Manager>.addTarget(target)

Add a proximity target to the manager.

<Manager>.clearSensors()

Remove all proximity sensors from the manager.

<Manager>.clearTargets()

Remove all proximity targets from the manager.

<Manager>.getActiveSensors(target=None)

Get a list of sensors that have been activated by the specified target since the last update. If target is None, then all active sensors will be returned.

<Manager>.getActiveTargets(sensor=None)

Get a list of targets that have activated the specified sensor since the last update. If sensor is None, then all active targets will be returned.

<Manager>.getDebug()

Get whether debugging of proximity sensor shapes is enabled.

<Manager>.getDebugColor()

Get the color for debug shapes.

<Manager>.getDebugActiveColor()

Get the active color for debug shapes.

<Manager>.getDebugNode()

Get the root node for the proximity sensor debugger. Use this to custom modify the appearance of the debug shapes.

<Manager>.getSensors()

Get a list of sensors that are assigned to the manager.

<Manager>.getSensorsContainingPoint(point)

Get a list of sensors that contain the specified point.

<Manager>.getSensorsContainingTarget(target)

Get a list of sensors that contain the specified target.

<Manager>.getTargets()

Get a list of targets that are assigned to the manager.

<Manager>.remove()

Remove the proximity manager.

<Manager>.removeSensor(sensor)

Remove a proximity sensor from the manager.

<Manager>.removeTarget(target)

Remove a proximity target from the manager.

<Manager>.setDebug(mode,

                             parent = viz.WORLD,

                             scene = viz.MainScene)

Set whether debugging of proximity sensor shapes is enabled.

mode: Can be set to viz.ON, viz.OFF, or viz.TOGGLE.

<Manager>.setDebugColor(color)

Set the color for debug shapes.

<Manager>.setDebugActiveColor(color)

Set the active color for debug shapes.

<Manager>.update()

Update state of proximity sensors and trigger enter/exit events if needed. This is automatically called every frame by the manager.

The manager object also provides methods to register callback functions for proximity events. These are described in the vizproximity events section.

Example

#Create proximity manager
manager = vizproximity.Manager()

#Create target and add to manager
target = vizproximity.Target(viz.MainView)
manager.addTarget(target)

#Create sensor and add to manager
sensor = vizproximity.Sensor(vizproximity.Sphere(1.0),source=viz.Matrix.translate(2,1.5,1))
manager.addSensor(sensor)

vizproximity introduction

vizproximity sensor

vizproximity target

vizproximity manager

vizproximity events