|
#1
|
|||
|
|||
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] Code:
def getTwist(self): """Returns the twist of the joystick""" return self.getRotation() 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] |
#2
|
|||
|
|||
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.
|
Tags |
vizjoy, xbox controller |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
viz.Vector and normalize method | shivanangel | Vizard | 1 | 08-02-2013 10:07 AM |
morphTo: Is there a smoother method? | Josh | Vizard | 1 | 03-08-2010 10:50 AM |
read method needed | Woosuk Jang | Vizard | 3 | 06-22-2009 06:49 PM |
parallel port method | bionic1 | Vizard | 2 | 05-04-2009 07:41 PM |
mapping method | FlyingFish | Vizard | 1 | 07-12-2007 10:06 AM |