WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Thread Tools Rate Thread Display Modes
Old 01-08-2012, 03:06 AM
nmohandes nmohandes is offline
Join Date: Jan 2012
Posts: 2
joystick position


I am writing a program and i need to take the joystick position when clicking on certain objects on the screen

like the user will select one object from the screen and then rotate it and then move the joystick to select another object ...

I have the code that have the position and move on empty screen

import viz
import vizjoy
import vizinfo
#IMPORTANT: Need to add a joystick. This will return the first detected joystick
joy = vizjoy.add()
#Add textures
hand = viz.addTexture('hand.jpg')
#Add the texture quad for the joystick position
joystick = viz.addTexQuad(viz.SCREEN)
#Set the joystick texture to the dot
JOY_SCALE = 10.0
#Joystick position has changed, update dot
def joymove(e):

#Set all the joystick callbacks

How i can select one specific object on the screen ... do some action ( rotate) and then select another one ..

any ideas or hints

thank you
Reply With Quote
Old 01-11-2012, 01:47 PM
Jeff Jeff is offline
WorldViz Team Member
Join Date: Aug 2008
Posts: 2,471
Take a look the viz.pick command. When you're not picking with the mouse you can specify the position on screen to perform the pick. In your case that's the quad position. Register a callback function using vizact.onupdate that calls the pick command every frame. If an object is returned then apply the action to it.
Reply With Quote
Old 01-16-2012, 10:03 AM
nmohandes nmohandes is offline
Join Date: Jan 2012
Posts: 2
Thank you
I was able to pick using the joystick

def pickone(object):
object = viz.pick()
if object.valid():
pos = joystick.getPosition()
Reply With Quote

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
changing the gain of a joystick during a program Saz Vizard 4 06-25-2009 03:49 AM
How to get the data from Logitech G25 racing wheel ? fuyonggang Vizard 4 12-18-2008 06:14 PM
writing joystick position to a data file Saz Vizard 3 12-17-2008 05:18 AM
Joystick Navigation Vinicius Lima Vizard 7 10-23-2007 10:42 AM
Facetracking and Immersion Joystick Vygreif Vizard 1 01-25-2006 10:56 AM

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

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