*** empty log message ***

This commit is contained in:
gregw 2002-02-25 21:09:32 +00:00
parent 94b1117f3c
commit 59f0a51f6c
2 changed files with 24 additions and 14 deletions

View File

@ -146,11 +146,7 @@ class DirectAnalogs(AnalogNode, DirectObject):
def normalizeChannel(self, chan, minVal = -1, maxVal = 1):
try:
if (chan == 2) or (chan == 6):
# These channels have reduced range
return self.normalize(self[chan] * 3.0, minVal, maxVal)
else:
return self.normalize(self[chan], minVal, maxVal)
return self.normalize(self[chan], minVal, maxVal)
except IndexError:
return 0.0

View File

@ -137,7 +137,7 @@ class DirectJoybox(PandaObject):
self.lastTime = cTime
# Update analogs
for i in range(len(self.analogs)):
self.aList[i] = self.analogs.normalizeChannel(i)
self.aList[i] = self.normalizeChannel(i)
# Update buttons
for i in range(len(self.buttons)):
try:
@ -217,9 +217,9 @@ class DirectJoybox(PandaObject):
if self.nodePath == None:
return
"""
hprScale = (self.analogs.normalizeChannel(L_SLIDE, 0.1, 100) *
hprScale = (self.normalizeChannel(L_SLIDE, 0.1, 100) *
DirectJoybox.hprMultiplier)
posScale = (self.analogs.normalizeChannel(R_SLIDE, 0.1, 100) *
posScale = (self.normalizeChannel(R_SLIDE, 0.1, 100) *
DirectJoybox.xyzMultiplier)
"""
hprScale = (self.aList[L_SLIDE] + 1.0) * 50.0 * DirectJoybox.hprMultiplier
@ -297,9 +297,9 @@ class DirectJoybox(PandaObject):
# Do nothing if no nodePath selected
if self.nodePath == None:
return
hprScale = (self.analogs.normalizeChannel(L_SLIDE, 0.1, 100) *
hprScale = (self.normalizeChannel(L_SLIDE, 0.1, 100) *
DirectJoybox.hprMultiplier)
posScale = (self.analogs.normalizeChannel(R_SLIDE, 0.1, 100) *
posScale = (self.normalizeChannel(R_SLIDE, 0.1, 100) *
DirectJoybox.xyzMultiplier)
dr = -1 * hprScale * self.aList[R_TWIST] * self.deltaTime
dp = -1 * hprScale * self.aList[R_FWD_BACK] * self.deltaTime
@ -316,9 +316,9 @@ class DirectJoybox(PandaObject):
# Do nothing if no nodePath selected
if self.nodePath == None:
return
hprScale = (self.analogs.normalizeChannel(L_SLIDE, 0.1, 100) *
hprScale = (self.normalizeChannel(L_SLIDE, 0.1, 100) *
DirectJoybox.hprMultiplier)
posScale = (self.analogs.normalizeChannel(R_SLIDE, 0.1, 100) *
posScale = (self.normalizeChannel(R_SLIDE, 0.1, 100) *
DirectJoybox.xyzMultiplier)
dr = -1 * hprScale * self.aList[R_TWIST] * self.deltaTime
dp = -1 * hprScale * self.aList[R_FWD_BACK] * self.deltaTime
@ -367,9 +367,9 @@ class DirectJoybox(PandaObject):
# Do nothing if no nodePath selected
if self.nodePath == None:
return
hprScale = (self.analogs.normalizeChannel(L_SLIDE, 0.1, 100) *
hprScale = (self.normalizeChannel(L_SLIDE, 0.1, 100) *
DirectJoybox.hprMultiplier)
posScale = (self.analogs.normalizeChannel(R_SLIDE, 0.1, 100) *
posScale = (self.normalizeChannel(R_SLIDE, 0.1, 100) *
DirectJoybox.xyzMultiplier)
r = -0.01 * posScale * self.aList[R_FWD_BACK] * self.deltaTime
rx = hprScale * self.aList[R_LEFT_RIGHT] * self.deltaTime
@ -403,3 +403,17 @@ class DirectJoybox(PandaObject):
# Restore the original hpr of the orbiter
self.nodePath.setHpr(self.tempCS, 0, 0, 0)
# We need to override the DirectAnalog normalizeChannel to
# correct the ranges of the two twist axes of the joybox.
def normalizeChannel(self, chan, minVal = -1, maxVal = 1):
try:
if (chan == L_TWIST) or (chan == R_TWIST):
# These channels have reduced range
return self.analogs.normalize(self[chan] * 3.0, minVal, maxVal)
else:
return self.analogs.normalize(self[chan], minVal, maxVal)
except IndexError:
return 0.0