WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   vizconnect documentation? (https://forum.worldviz.com/showthread.php?t=5972)

fivel_lab 03-07-2017 09:49 AM

vizconnect documentation?
 
Hi!
Is there any detailed vizconnect documentation available (e.g., like the command indexes available for other modules, or something similar)? I can see through the IDE that there are a lot of methods available for objects returned from vizconnect but it's difficult to figure out what they do or how to use them.

Specifically, I am curious about vizconnect.getInput and vizconnect.setUpdateFunction. I want to get a handle to the joystick specified in vizconnect config file and specify my own update function for it. Is the object returned from getInput the joystick? or some kind of wrapper? if the former, what arguments do I need to pass to setupdatefunction to specify my own update function? if the latter, how do i get the joystick itself?

Thanks..

Jeff 03-07-2017 08:46 PM

Each time an object is added in vizconnect, both a raw and a wrapper object are added to the vizconnect session. The raw object is the same as the tracker, display window, input device etc. that is returned when using Vizard code to add the object. The wrapper object is a vizconnect layer that wraps up the raw object along with meta data and may include additional functionality based on the object type. The raw object is accessible from the wrapper:

Code:

joystick = vizconnect.getInput('joystick').getRaw()
The setUpdateFunction is called on a transport and defines the input signals that controls its movements. Are you trying to customize how the joystick moves a transport? If so, how do you want it to operate?

fivel_lab 03-20-2017 09:38 AM

Hi Jeff.. thanks for your help. Actually, I am just trying to intercept buttondown events on the joystick so I can send them to a function that determines the appropriate action to take based on the button pressed. I am upgrading from a vizard 4 set up where I had a modified onSensorDown function doing that. Is there an easier way to do that in vizard 5 or do I still need the handle to the raw joystick to accomplish this?

Jeff 03-21-2017 12:05 AM

You can create a custom event in vizconnect that's triggered using a signal from an input device:
  • Add an input device from the Inputs tab, in this case the joystick
  • Go to the Events tab in Vizconnect, add an event and give it a name (e.g. MY_EVENT)
  • Press the mappings button to define the input signal (button number) that triggers the event
  • In the application script, register a callback function for the event:

Code:

def myFunction(e):
    print 'event triggered'

viz.callback(viz.getEventID('MY_EVENT'), myFunction)


fivel_lab 03-27-2017 09:17 AM

Thanks! very helpful. It seems like vizconnect has an amazing amount of functionality that would be very useful.. Can you point me to more extensive documentation of vizconnect that I could explore? Or is that not available yet? Thanks!

Jeff 03-28-2017 11:57 PM

The vizconnect documentation we have is in the tutorials and reference sections of the Vizard Help. We hope to add documentation for the vizconnect API in the future which applies more to using vizconnect objects in the application script.


All times are GMT -7. The time now is 04:27 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2021, vBulletin Solutions, Inc.
Copyright 2002-2018 WorldViz LLC