Vizard 8 » Reference » Input Devices » Position and Orientation Trackers » WorldViz PPT
8.1

WorldViz PPT plug-in

This plug-in provides support for the WorldViz PPT Wand device.

Initialization

The PPT plug-in is implemented as a Vizard extension, with the following methods/constants:

Method

Description

<ppt>.addWand(port=0)

Add a PPT Wand device on the specified port. If port is 0, then automatically detect the wand on all available ports. A Wand sensor object will be returned.

<ppt>.BUTTON_JOYSTICK

<ppt>.BUTTON_UP

<ppt>.BUTTON_DOWN

<ppt>.BUTTON_LEFT

<ppt>.BUTTON_RIGHT

<ppt>.BUTTON_CENTER

<ppt>.BUTTON_TRIGGER

Button IDs supported by the PPT Wand sensor.

<ppt>.WAND

<ppt>.JOYSTICK

PPT Wand sensor position/rotation flags. The default flag is <ppt>.WAND.

The PPT Wand sensor provides orientation, button, and joystick data. The Wand object contains the following methods, in addition to the standard extension sensor methods:

Method Description
<wand>.getJoystick() Get the joystick [x,y] position which will be in the [-1,1] range. This is a shortcut for calling <wand>.getPosition() with the <ppt>.JOYSTICK flag.

Example

This example shows how to connect to a PPT Wand device on port 1:

# Add PPT extension
ppt = viz.add('ppt.dle')

# Add wand
wand = ppt.addWand(1)

The following code shows how to detect when the trigger button on the Wand is pressed:

import vizact

def onTrigger():
    print('Trigger pressed')
   
vizact.onsensordown(wand, ppt.BUTTON_TRIGGER, onTrigger)

The PPT Wand sensor also support the vizconfig interface so you can quickly see the button/joystick values:

# Register wand with vizconfig window
import vizconfig
vizconfig.register(wand)