WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 11-04-2013, 10:30 AM
shivanangel shivanangel is offline
Member
 
Join Date: Feb 2006
Location: New Jersey
Posts: 182
Question vizjoy.py Twist method

Going over some old code and I had a question.

Years ago, I modified vizjoy.py for the twist method.
The original method is:

Code:
def getTwist(self):
	"""Returns the twist of the joystick"""
	return self.getRotation()[2]
My new method hardly changed anything:

Code:
def getTwist(self):
	"""Returns the twist of the joystick"""
	return self.getRotation()
Why do you only return the second element of the joystick? For other hardware such as the XBoxController with 2 sticks, I can't directly query the state without this information or utilize the overwritten callback to twist that is in your documentation.

That is, I wouldn't be able to do the following with only one element being passed from getTwist

Code:
def twist(self, val):
	self.xRAccel = 0.0
	self.yRAccel = 0.0
		
	if (abs(val.twist[0]) >= self.deadZone):
		self.xRAccel = val.twist[0]

	if (abs(val.twist[1]) >= self.deadZone):
		self.yRAccel = val.twist[1]
Is there something I am missing? Is there another method someplace to get this information about the second analog stick?
Reply With Quote
  #2  
Old 11-05-2013, 09:13 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
If you want all rotation values, then simply call joy.getRotation() instead of joy.getTwist(). As shown in the code you posted, getTwist is simply a convenience method to get the Z-rotation value of the joystick. There is no need to modify vizjoy.
Reply With Quote
Reply

Tags
vizjoy, xbox controller

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
viz.Vector and normalize method shivanangel Vizard 1 08-02-2013 09:07 AM
morphTo: Is there a smoother method? Josh Vizard 1 03-08-2010 09:50 AM
read method needed Woosuk Jang Vizard 3 06-22-2009 05:49 PM
parallel port method bionic1 Vizard 2 05-04-2009 06:41 PM
mapping method FlyingFish Vizard 1 07-12-2007 09:06 AM


All times are GMT -7. The time now is 05:47 AM.


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