WorldViz User Forum

WorldViz User Forum (
-   Vizard (
-   -   Move canvas mouse with WorldViz wand (

CDreiser 03-13-2018 03:57 PM

Move canvas mouse with WorldViz wand
In the vizard demo launcher, there is a menu that can be interacted with by pointing the wand at it to move the mouse. So far I have the canvas set up, and I have set the canvas mouse style to CANVAS_MOUSE_VISIBLE, but I am somewhat lost on the rest. Here is the function I have come up with:


def manualCursorPositionTask():
        global listDisplayed, grabber
        while True:
                if listDisplayed:
                        pos = grabber.getPosition()
                        x = pos[0],y=pos[1],z=pos[2]
                        euler = grabber.getEuler()
                        intersection = viz.intersect([x + math.sin(euler.yaw/180*math.pi),y,z + math.sin(euler.pitch/180*math.pi)], [x + 100*math.sin(euler.yaw/180*math.pi),y,z + 100*math.sin(euler.pitch)/180*math.pi])
                        if ==
                                canvas.setCursorPosition(intersection.point, viz.CANVAS_CURSOR_PIXELS)

                yield viztask.waitFrame(1)

This is based off of example code I found in example code, specifically This code does not seem to work, however. I have used viz.director() to add the function to Vizard's task management as well. If anyone could explain to me what I would need to do to interact with a menu by pointing the wand, or what's wrong with my methodology, I could really use an explanation. Thanks.

All times are GMT -7. The time now is 02:00 PM.

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