WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 03-13-2018, 04:57 PM
CDreiser CDreiser is offline
Member
 
Join Date: Feb 2018
Posts: 3
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:

Code:
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 intersection.object.id == canvas.id:
				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 canvasExample.py. 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.
Reply With Quote
Reply

Tags
canvas, interact, mouse, wand

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Mouse bug in V3 and V4 Renato Lima Vizard 2 05-11-2011 07:38 PM
Mouse event: how to detect no mouse move event, how to set mouse position? Zhi Vizard 3 04-11-2011 07:25 PM
Mouse pointer problem Albert Russel Vizard 2 02-21-2011 02:10 AM
Navigating an avatar using mouse position(2D) in 3D environment james007 Vizard 1 10-16-2009 12:29 PM
how to pick up the object, move and rotate using mouse nasr Vizard 5 05-05-2009 04:11 AM


All times are GMT -7. The time now is 02:24 AM.


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