WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 01-27-2009, 09:25 PM
AlyssaK AlyssaK is offline
Member
 
Join Date: Dec 2006
Posts: 16
set mouse position

Hi all,

I would like to know if its is possible to set the mouse position???

I found the method viz.mousepos and have assigned it the value of the wiimote coordinates however the cursor does not move.

If you can help please post a response.

ALyssa
Reply With Quote
  #2  
Old 01-28-2009, 05:05 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
The following script shows how to use a wiimote to control the mouse movement and simulate mouse button presses:
Code:
import viz
import win32api
import win32con

viz.go()

#Create wii extension
wii = viz.add('wiimote.dle')

#Connect to wiimote
wiimote = wii.addWiimote()
if not wiimote.valid():
	sys.exit()
	
#Use wiimote button B to simulate left mouse click
def SimulateMouseButton(button):
	win32api.mouse_event(button,0,0,0)
vizact.onsensordown(wiimote,wii.BUTTON_B,SimulateMouseButton,win32con.MOUSEEVENTF_LEFTDOWN)
vizact.onsensorup(wiimote,wii.BUTTON_B,SimulateMouseButton,win32con.MOUSEEVENTF_LEFTUP)

#Use wiimote IR sensor position to simulate mouse movement
def SimulateMouseMove():
	x,y = wiimote.posIR
	win32api.mouse_event(win32con.MOUSEEVENTF_ABSOLUTE|win32con.MOUSEEVENTF_MOVE,int(65535*x),int(65535*(1.0-y)),0)
vizact.ontimer(0,SimulateMouseMove)
Reply With Quote
Reply


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
writing joystick position to a data file Saz Vizard 3 12-17-2008 06:18 AM
default start position erchrastil Vizard 2 06-23-2008 09:15 AM
Avatar always returns in initial position pattie Vizard 2 08-31-2006 09:15 PM
Mouse problem steve Vizard 7 07-14-2005 04:01 PM
Halting mouse view-transforms FlyingWren Vizard 1 10-01-2003 06:29 PM


All times are GMT -7. The time now is 09:59 AM.


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