WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Thread Tools Rate Thread Display Modes
Old 01-28-2004, 12:01 PM
Plasma Plasma is offline
Join Date: Jan 2004
Posts: 22
Basic Joystick Navigation Question

Here's a really basic question:

I'm using a Logitech Cordless Freedom 2.4 joystick, and I know Vizard is recognizing it because it prints:

Logitech Freedom 2.4 USB Supported: Y Axis, X Axis, Slider, Rz, 10 Buttons, Hat Switch

in the winviz.exe DOS screen.

I have "import sid" at the beginning of the program.

How do I get it to navigate the environment using the joystick instead of the mouse? The tutorial files just outline how to get information from the joystick but not how to use that information to navigate.

Also, is it possible to use the stick twist to rotate within the environment (i.e. to turn corners, etc.)?

Reply With Quote
Old 01-28-2004, 12:36 PM
farshizzo farshizzo is offline
WorldViz Team Member
Join Date: Mar 2003
Posts: 2,849

There is no built-in functionality to control the viewpoint with the joystick, but it's still really easy to do. Here is some code that will use the joystick to move forward/backward and right/left. It will also use the twist of the joystick to rotate the viewpoint left and right. This example does not import any models, so you'll have to import your own model in order to navigate around.
import viz
import sid
import math


def mytimer(num):
	y = sid.get()[1]
	x = sid.get()[0]
	twist = (180.0 / math.pi) * (sid.aux()[3])
	if math.fabs(y) > 0.2:
	if math.fabs(x) > 0.2:
	if math.fabs(twist) > 20:
Hope this helps!
Reply With Quote
Old 01-29-2004, 07:08 PM
Plasma Plasma is offline
Join Date: Jan 2004
Posts: 22
Works perfectly. Thanks a lot!
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

All times are GMT -7. The time now is 06:19 AM.

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