formatting

This commit is contained in:
Dave Schuyler 2006-03-17 23:17:57 +00:00
parent 3429171dc5
commit f66d4151fc
4 changed files with 84 additions and 82 deletions

View File

@ -27,11 +27,11 @@ class ShipPilot2(PhysicsWalker):
notify = directNotify.newCategory("PhysicsWalker") notify = directNotify.newCategory("PhysicsWalker")
wantDebugIndicator = base.config.GetBool( wantDebugIndicator = base.config.GetBool(
'want-avatar-physics-indicator', 0) 'want-avatar-physics-indicator', 0)
useBowSternSpheres = 1 useBowSternSpheres = 1
useLifter = 0 useLifter = 0
useHeightRay = 0 useHeightRay = 0
# special methods # special methods
def __init__(self, gravity = -32.1740, standableGround=0.707, def __init__(self, gravity = -32.1740, standableGround=0.707,
hardLandingForce=16.0): hardLandingForce=16.0):
@ -43,7 +43,7 @@ class ShipPilot2(PhysicsWalker):
self.__gravity=gravity self.__gravity=gravity
self.__standableGround=standableGround self.__standableGround=standableGround
self.__hardLandingForce=hardLandingForce self.__hardLandingForce=hardLandingForce
self.needToDeltaPos = 0 self.needToDeltaPos = 0
self.physVelocityIndicator=None self.physVelocityIndicator=None
self.avatarControlForwardSpeed=0 self.avatarControlForwardSpeed=0
@ -60,7 +60,7 @@ class ShipPilot2(PhysicsWalker):
self.__slideSpeed=0.0 self.__slideSpeed=0.0
self.__vel=Vec3(0.0) self.__vel=Vec3(0.0)
self.collisionsActive = 0 self.collisionsActive = 0
self.isAirborne = 0 self.isAirborne = 0
self.highMark = 0 self.highMark = 0
self.ship = None self.ship = None
@ -86,7 +86,7 @@ class ShipPilot2(PhysicsWalker):
#self.setupShip() #self.setupShip()
self.setupPhysics(ship) self.setupPhysics(ship)
self.ship = ship self.ship = ship
#*# Debug: #*# Debug:
if not hasattr(ship, "acceleration"): if not hasattr(ship, "acceleration"):
self.ship.acceleration = 60 self.ship.acceleration = 60
@ -204,6 +204,7 @@ class ShipPilot2(PhysicsWalker):
cBowSphereNode.addSolid(self.cBowSphere) cBowSphereNode.addSolid(self.cBowSphere)
self.cBowSphereNodePath = self.avatarNodePath.attachNewNode( self.cBowSphereNodePath = self.avatarNodePath.attachNewNode(
cBowSphereNode) cBowSphereNode)
#self.cBowSphereNodePath.show()
cBowSphereNode.setFromCollideMask(self.cSphereBitMask) cBowSphereNode.setFromCollideMask(self.cSphereBitMask)
cBowSphereNode.setIntoCollideMask(BitMask32.allOff()) cBowSphereNode.setIntoCollideMask(BitMask32.allOff())
@ -212,7 +213,7 @@ class ShipPilot2(PhysicsWalker):
self.pusher.addCollider( self.pusher.addCollider(
self.cBowSphereNodePath, self.avatarNodePath) self.cBowSphereNodePath, self.avatarNodePath)
# Back sphere: # Back sphere:
self.cSternSphere = CollisionSphere( self.cSternSphere = CollisionSphere(
0.0, self.backSphereOffset, -5.0, avatarRadius) 0.0, self.backSphereOffset, -5.0, avatarRadius)
@ -220,6 +221,7 @@ class ShipPilot2(PhysicsWalker):
cSternSphereNode.addSolid(self.cSternSphere) cSternSphereNode.addSolid(self.cSternSphere)
self.cSternSphereNodePath = self.avatarNodePath.attachNewNode( self.cSternSphereNodePath = self.avatarNodePath.attachNewNode(
cSternSphereNode) cSternSphereNode)
#self.cSternSphereNodePath.show()
self.cSternSphereBitMask = bitmask self.cSternSphereBitMask = bitmask
cSternSphereNode.setFromCollideMask(self.cSphereBitMask) cSternSphereNode.setFromCollideMask(self.cSphereBitMask)
@ -233,7 +235,7 @@ class ShipPilot2(PhysicsWalker):
shipCollWall = self.avatarNodePath.hull.find("**/collision_hull") shipCollWall = self.avatarNodePath.hull.find("**/collision_hull")
if not shipCollWall.isEmpty(): if not shipCollWall.isEmpty():
shipCollWall.stash() shipCollWall.stash()
def takedownPhysics(self): def takedownPhysics(self):
assert self.debugPrint("takedownPhysics()") assert self.debugPrint("takedownPhysics()")
if 0: if 0:
@ -243,7 +245,7 @@ class ShipPilot2(PhysicsWalker):
del self.phys del self.phys
if self.ship != None: if self.ship != None:
self.ship.worldVelocity = Vec3.zero() self.ship.worldVelocity = Vec3.zero()
def setupPhysics(self, avatarNodePath): def setupPhysics(self, avatarNodePath):
assert self.debugPrint("setupPhysics()") assert self.debugPrint("setupPhysics()")
if avatarNodePath is None: if avatarNodePath is None:
@ -288,7 +290,7 @@ class ShipPilot2(PhysicsWalker):
width is feet from port to starboard. width is feet from port to starboard.
length is feet from aft to bow. length is feet from aft to bow.
height is feet from bildge to deck (i.e. not including mast height). height is feet from bildge to deck (i.e. not including mast height).
Set up the avatar collisions Set up the avatar collisions
""" """
assert self.debugPrint("initializeCollisions()") assert self.debugPrint("initializeCollisions()")
@ -318,7 +320,7 @@ class ShipPilot2(PhysicsWalker):
del self.cSphereNodePath del self.cSphereNodePath
del self.pusher del self.pusher
self.getAirborneHeight = None self.getAirborneHeight = None
def setTag(self, key, value): def setTag(self, key, value):
@ -413,11 +415,11 @@ class ShipPilot2(PhysicsWalker):
assert self.debugPrint( assert self.debugPrint(
"getCollisionsActive() returning=%s"%(self.collisionsActive,)) "getCollisionsActive() returning=%s"%(self.collisionsActive,))
return self.collisionsActive return self.collisionsActive
def placeOnFloor(self): def placeOnFloor(self):
""" """
Make a reasonable effort to place the avatar on the ground. Make a reasonable effort to place the avatar on the ground.
For example, this is useful when switching away from the For example, this is useful when switching away from the
current walker. current walker.
""" """
self.oneTimeCollide() self.oneTimeCollide()
@ -491,7 +493,7 @@ class ShipPilot2(PhysicsWalker):
## onScreenDebug.add("w keel vec", ## onScreenDebug.add("w keel vec",
## keel.pPrintValues()) ## keel.pPrintValues())
if 0: if 0:
onScreenDebug.add("posDelta4", onScreenDebug.add("posDelta4",
self.priorParentNp.getRelativeVector( self.priorParentNp.getRelativeVector(
render, render,
self.avatarNodePath.getPosDelta(render)).pPrintValues()) self.avatarNodePath.getPosDelta(render)).pPrintValues())
@ -551,14 +553,14 @@ class ShipPilot2(PhysicsWalker):
self.sailsDeployed = -1.0 self.sailsDeployed = -1.0
self.__speed = self.ship.acceleration * self.sailsDeployed self.__speed = self.ship.acceleration * self.sailsDeployed
else: else:
self.__speed=(forward and self.ship.acceleration or self.__speed=(forward and self.ship.acceleration or
reverse and -self.ship.reverseAcceleration) reverse and -self.ship.reverseAcceleration)
avatarSlideSpeed=self.ship.acceleration*0.5 avatarSlideSpeed=self.ship.acceleration*0.5
#self.__slideSpeed=slide and ( #self.__slideSpeed=slide and (
# (turnLeft and -avatarSlideSpeed) or # (turnLeft and -avatarSlideSpeed) or
# (turnRight and avatarSlideSpeed)) # (turnRight and avatarSlideSpeed))
self.__slideSpeed=(forward or reverse) and ( self.__slideSpeed=(forward or reverse) and (
(slideLeft and -avatarSlideSpeed) or (slideLeft and -avatarSlideSpeed) or
(slideRight and avatarSlideSpeed)) (slideRight and avatarSlideSpeed))
self.__rotationSpeed=not slide and ( self.__rotationSpeed=not slide and (
(turnLeft and self.ship.turnRate) or (turnLeft and self.ship.turnRate) or
@ -696,8 +698,8 @@ class ShipPilot2(PhysicsWalker):
physVel = physObject.getVelocity() physVel = physObject.getVelocity()
physVelLen = physVel.length() physVelLen = physVel.length()
if (physVelLen!=0. if (physVelLen!=0.
or self.__speed or self.__speed
or self.__slideSpeed or self.__slideSpeed
or self.__rotationSpeed): or self.__rotationSpeed):
distance = dt * self.__speed distance = dt * self.__speed
goForward = True goForward = True
@ -705,11 +707,11 @@ class ShipPilot2(PhysicsWalker):
goForward = False goForward = False
slideDistance = dt * self.__slideSpeed slideDistance = dt * self.__slideSpeed
rotation = dt * self.__rotationSpeed rotation = dt * self.__rotationSpeed
# update pos: # update pos:
# Take a step in the direction of our previous heading. # Take a step in the direction of our previous heading.
self.__vel=Vec3( self.__vel=Vec3(
Vec3.forward() * distance + Vec3.forward() * distance +
Vec3.right() * slideDistance) Vec3.right() * slideDistance)
# rotMat is the rotation matrix corresponding to # rotMat is the rotation matrix corresponding to
@ -740,8 +742,8 @@ class ShipPilot2(PhysicsWalker):
assert base.controlForce.getLocalVector() == newVector assert base.controlForce.getLocalVector() == newVector
assert base.controlForce.getPhysicsObject() assert base.controlForce.getPhysicsObject()
assert base.controlForce.getPhysicsObject() == physObject assert base.controlForce.getPhysicsObject() == physObject
#momentum = self.momentumForce.getLocalVector() #momentum = self.momentumForce.getLocalVector()
#momentum *= 0.9 #momentum *= 0.9
#self.momentumForce.setVector(momentum) #self.momentumForce.setVector(momentum)
@ -762,7 +764,7 @@ class ShipPilot2(PhysicsWalker):
#base.controlForce.setVector(Vec3.zero()) #base.controlForce.setVector(Vec3.zero())
goForward = True goForward = True
#*# #*#
speed = physVel speed = physVel
if (goForward): if (goForward):
@ -817,28 +819,28 @@ class ShipPilot2(PhysicsWalker):
self.ship.worldVelocity.pPrintValues()) self.ship.worldVelocity.pPrintValues())
onScreenDebug.add("w worldVelocity len", onScreenDebug.add("w worldVelocity len",
"% 10.4f"%self.ship.worldVelocity.length()) "% 10.4f"%self.ship.worldVelocity.length())
# if hasattr(self.ship, 'sailBillow'): # if hasattr(self.ship, 'sailBillow'):
# self.ship.sailBillow = self.sailsDeployed # self.ship.sailBillow = self.sailsDeployed
if hasattr(self.ship, 'currentTurning'): if hasattr(self.ship, 'currentTurning'):
self.ship.currentTurning = self.currentTurning self.ship.currentTurning = self.currentTurning
return Task.cont return Task.cont
def doDeltaPos(self): def doDeltaPos(self):
assert self.debugPrint("doDeltaPos()") assert self.debugPrint("doDeltaPos()")
self.needToDeltaPos = 1 self.needToDeltaPos = 1
def setPriorParentVector(self): def setPriorParentVector(self):
assert self.debugPrint("doDeltaPos()") assert self.debugPrint("doDeltaPos()")
#print "self.__oldDt", self.__oldDt, "self.__oldPosDelta", self.__oldPosDelta #print "self.__oldDt", self.__oldDt, "self.__oldPosDelta", self.__oldPosDelta
if __debug__: if __debug__:
onScreenDebug.add("__oldDt", "% 10.4f"%self.__oldDt) onScreenDebug.add("__oldDt", "% 10.4f"%self.__oldDt)
onScreenDebug.add("self.__oldPosDelta", onScreenDebug.add("self.__oldPosDelta",
self.__oldPosDelta.pPrintValues()) self.__oldPosDelta.pPrintValues())
velocity = self.__oldPosDelta*(1/self.__oldDt)*4.0 # *4.0 is a hack velocity = self.__oldPosDelta*(1/self.__oldDt)*4.0 # *4.0 is a hack
assert self.debugPrint(" __oldPosDelta=%s"%(self.__oldPosDelta,)) assert self.debugPrint(" __oldPosDelta=%s"%(self.__oldPosDelta,))
assert self.debugPrint(" velocity=%s"%(velocity,)) assert self.debugPrint(" velocity=%s"%(velocity,))
@ -846,7 +848,7 @@ class ShipPilot2(PhysicsWalker):
if __debug__: if __debug__:
if self.wantDebugIndicator: if self.wantDebugIndicator:
onScreenDebug.add("velocity", velocity.pPrintValues()) onScreenDebug.add("velocity", velocity.pPrintValues())
def reset(self): def reset(self):
assert self.debugPrint("reset()") assert self.debugPrint("reset()")
self.actorNode.getPhysicsObject().resetPosition( self.actorNode.getPhysicsObject().resetPosition(

View File

@ -34,7 +34,7 @@
else: else:
self.hide() self.hide()
return 0 return 0
def showSiblings(self): def showSiblings(self):
"""Show all the siblings of a node path""" """Show all the siblings of a node path"""
for sib in self.getParent().getChildrenAsList(): for sib in self.getParent().getChildrenAsList():
@ -108,7 +108,7 @@
from pandac import Point3 from pandac import Point3
v1 = Point3.Point3(0) v1 = Point3.Point3(0)
v2 = Point3.Point3(0) v2 = Point3.Point3(0)
self.calcTightBounds(v1,v2) self.calcTightBounds(v1, v2)
return v1, v2 return v1, v2
def pPrintString(self, other = None): def pPrintString(self, other = None):
@ -134,7 +134,7 @@
otherString = '\n' otherString = '\n'
return ( return (
"%s = {"%(self.getName()) + "%s = {"%(self.getName()) +
otherString + otherString +
" 'Pos': (%s),\n" % pos.pPrintValues() + " 'Pos': (%s),\n" % pos.pPrintValues() +
" 'Hpr': (%s),\n" % hpr.pPrintValues() + " 'Hpr': (%s),\n" % hpr.pPrintValues() +
" 'Scale': (%s),\n" % scale.pPrintValues() + " 'Scale': (%s),\n" % scale.pPrintValues() +
@ -150,7 +150,7 @@
else: else:
pos = self.getPos() pos = self.getPos()
otherString = '' otherString = ''
print (self.getName() + '.setPos(' + otherString + print (self.getName() + '.setPos(' + otherString +
formatString % pos[0] + ', ' + formatString % pos[0] + ', ' +
formatString % pos[1] + ', ' + formatString % pos[1] + ', ' +
formatString % pos[2] + formatString % pos[2] +
@ -165,7 +165,7 @@
else: else:
hpr = self.getHpr() hpr = self.getHpr()
otherString = '' otherString = ''
print (self.getName() + '.setHpr(' + otherString + print (self.getName() + '.setHpr(' + otherString +
formatString % hpr[0] + ', ' + formatString % hpr[0] + ', ' +
formatString % hpr[1] + ', ' + formatString % hpr[1] + ', ' +
formatString % hpr[2] + formatString % hpr[2] +
@ -180,7 +180,7 @@
else: else:
scale = self.getScale() scale = self.getScale()
otherString = '' otherString = ''
print (self.getName() + '.setScale(' + otherString + print (self.getName() + '.setScale(' + otherString +
formatString % scale[0] + ', ' + formatString % scale[0] + ', ' +
formatString % scale[1] + ', ' + formatString % scale[1] + ', ' +
formatString % scale[2] + formatString % scale[2] +
@ -197,7 +197,7 @@
pos = self.getPos() pos = self.getPos()
hpr = self.getHpr() hpr = self.getHpr()
otherString = '' otherString = ''
print (self.getName() + '.setPosHpr(' + otherString + print (self.getName() + '.setPosHpr(' + otherString +
formatString % pos[0] + ', ' + formatString % pos[0] + ', ' +
formatString % pos[1] + ', ' + formatString % pos[1] + ', ' +
formatString % pos[2] + ', ' + formatString % pos[2] + ', ' +
@ -219,7 +219,7 @@
hpr = self.getHpr() hpr = self.getHpr()
scale = self.getScale() scale = self.getScale()
otherString = '' otherString = ''
print (self.getName() + '.setPosHprScale(' + otherString + print (self.getName() + '.setPosHprScale(' + otherString +
formatString % pos[0] + ', ' + formatString % pos[0] + ', ' +
formatString % pos[1] + ', ' + formatString % pos[1] + ', ' +
formatString % pos[2] + ', ' + formatString % pos[2] + ', ' +
@ -238,17 +238,17 @@
if other == None: if other == None:
transform = self.getTransform() transform = self.getTransform()
else: else:
transform = self.getTransform(other) transform = self.getTransform(other)
if transform.hasPos(): if transform.hasPos():
pos = transform.getPos() pos = transform.getPos()
if not pos.almostEqual(Vec3(0)): if not pos.almostEqual(Vec3(0)):
outputString = '%s.setPos(%s, %s, %s)' % (name, fmtStr, fmtStr, fmtStr) outputString = '%s.setPos(%s, %s, %s)' % (name, fmtStr, fmtStr, fmtStr)
print outputString % (pos[0], pos[1], pos[2]) print outputString % (pos[0], pos[1], pos[2])
if transform.hasHpr(): if transform.hasHpr():
hpr = transform.getHpr() hpr = transform.getHpr()
if not hpr.almostEqual(Vec3(0)): if not hpr.almostEqual(Vec3(0)):
outputString = '%s.setHpr(%s, %s, %s)' % (name, fmtStr, fmtStr, fmtStr) outputString = '%s.setHpr(%s, %s, %s)' % (name, fmtStr, fmtStr, fmtStr)
print outputString % (hpr[0], hpr[1], hpr[2]) print outputString % (hpr[0], hpr[1], hpr[2])
if transform.hasScale(): if transform.hasScale():
if transform.hasUniformScale(): if transform.hasUniformScale():
scale = transform.getUniformScale() scale = transform.getUniformScale()
@ -265,42 +265,42 @@
child.printTransform(other, sd, fRecursive) child.printTransform(other, sd, fRecursive)
def iPos(self, other = None): def iPos(self, other = None):
""" Set node path's pos to 0,0,0 """ """ Set node path's pos to 0, 0, 0 """
if other: if other:
self.setPos(other, 0,0,0) self.setPos(other, 0, 0, 0)
else: else:
self.setPos(0,0,0) self.setPos(0, 0, 0)
def iHpr(self, other = None): def iHpr(self, other = None):
""" Set node path's hpr to 0,0,0 """ """ Set node path's hpr to 0, 0, 0 """
if other: if other:
self.setHpr(other, 0,0,0) self.setHpr(other, 0, 0, 0)
else: else:
self.setHpr(0,0,0) self.setHpr(0, 0, 0)
def iScale(self, other = None): def iScale(self, other = None):
""" SEt node path's scale to 1,1,1 """ """ SEt node path's scale to 1, 1, 1 """
if other: if other:
self.setScale(other, 1,1,1) self.setScale(other, 1, 1, 1)
else: else:
self.setScale(1,1,1) self.setScale(1, 1, 1)
def iPosHpr(self, other = None): def iPosHpr(self, other = None):
""" Set node path's pos and hpr to 0,0,0 """ """ Set node path's pos and hpr to 0, 0, 0 """
if other: if other:
self.setPosHpr(other,0,0,0,0,0,0) self.setPosHpr(other, 0, 0, 0, 0, 0, 0)
else: else:
self.setPosHpr(0,0,0,0,0,0) self.setPosHpr(0, 0, 0, 0, 0, 0)
def iPosHprScale(self, other = None): def iPosHprScale(self, other = None):
""" Set node path's pos and hpr to 0,0,0 and scale to 1,1,1 """ """ Set node path's pos and hpr to 0, 0, 0 and scale to 1, 1, 1 """
if other: if other:
self.setPosHprScale(other, 0,0,0,0,0,0,1,1,1) self.setPosHprScale(other, 0, 0, 0, 0, 0, 0, 1, 1, 1)
else: else:
self.setPosHprScale(0,0,0,0,0,0,1,1,1) self.setPosHprScale(0, 0, 0, 0, 0, 0, 1, 1, 1)
# private methods # private methods
def __lerp(self, functorFunc, duration, blendType, taskName=None): def __lerp(self, functorFunc, duration, blendType, taskName=None):
""" """
__lerp(self, functorFunc, float, string, string) __lerp(self, functorFunc, float, string, string)
@ -313,7 +313,7 @@
from direct.task import Task from direct.task import Task
from direct.showbase import LerpBlendHelpers from direct.showbase import LerpBlendHelpers
from direct.task.TaskManagerGlobal import taskMgr from direct.task.TaskManagerGlobal import taskMgr
# upon death remove the functorFunc # upon death remove the functorFunc
def lerpUponDeath(task): def lerpUponDeath(task):
# Try to break circular references # Try to break circular references
@ -325,7 +325,7 @@
del task.lerp del task.lerp
except: except:
pass pass
# make the task function # make the task function
def lerpTaskFunc(task): def lerpTaskFunc(task):
from pandac.Lerp import Lerp from pandac.Lerp import Lerp
@ -345,7 +345,7 @@
return(done) return(done)
else: else:
return(cont) return(cont)
# make the lerp task # make the lerp task
lerpTask = Task.Task(lerpTaskFunc) lerpTask = Task.Task(lerpTaskFunc)
lerpTask.init = 1 lerpTask.init = 1
@ -353,7 +353,7 @@
lerpTask.duration = duration lerpTask.duration = duration
lerpTask.blendType = LerpBlendHelpers.getBlend(blendType) lerpTask.blendType = LerpBlendHelpers.getBlend(blendType)
lerpTask.uponDeath = lerpUponDeath lerpTask.uponDeath = lerpUponDeath
if (taskName == None): if (taskName == None):
# don't spawn a task, return one instead # don't spawn a task, return one instead
return lerpTask return lerpTask
@ -394,7 +394,7 @@
# bad args # bad args
raise Exception("Error: NodePath.lerpColor: bad number of args") raise Exception("Error: NodePath.lerpColor: bad number of args")
def lerpColorRGBA(self, r, g, b, a, time, def lerpColorRGBA(self, r, g, b, a, time,
blendType="noBlend", auto=None, task=None): blendType="noBlend", auto=None, task=None):
"""lerpColorRGBA(self, float, float, float, float, float, """lerpColorRGBA(self, float, float, float, float, float,
@ -497,7 +497,7 @@
# bad args # bad args
raise Exception("Error: NodePath.lerpColorScale: bad number of args") raise Exception("Error: NodePath.lerpColorScale: bad number of args")
def lerpColorScaleRGBA(self, r, g, b, a, time, def lerpColorScaleRGBA(self, r, g, b, a, time,
blendType="noBlend", auto=None, task=None): blendType="noBlend", auto=None, task=None):
"""lerpColorScaleRGBA(self, float, float, float, float, float, """lerpColorScaleRGBA(self, float, float, float, float, float,
@ -581,7 +581,7 @@
else: else:
return self.__lerp(functorFunc, time, blendType) return self.__lerp(functorFunc, time, blendType)
def lerpHpr(self, *posArgs, **keyArgs): def lerpHpr(self, *posArgs, **keyArgs):
"""lerpHpr(self, *positionArgs, **keywordArgs) """lerpHpr(self, *positionArgs, **keywordArgs)
@ -597,7 +597,7 @@
else: else:
# bad args # bad args
raise Exception("Error: NodePath.lerpHpr: bad number of args") raise Exception("Error: NodePath.lerpHpr: bad number of args")
def lerpHprHPR(self, h, p, r, time, other=None, def lerpHprHPR(self, h, p, r, time, other=None,
blendType="noBlend", auto=None, task=None, shortest=1): blendType="noBlend", auto=None, task=None, shortest=1):
"""lerpHprHPR(self, float, float, float, float, string="noBlend", """lerpHprHPR(self, float, float, float, float, string="noBlend",
@ -633,7 +633,7 @@
return self.__lerp(functorFunc, time, blendType, task) return self.__lerp(functorFunc, time, blendType, task)
else: else:
return self.__lerp(functorFunc, time, blendType) return self.__lerp(functorFunc, time, blendType)
def lerpHprVBase3(self, hpr, time, other=None, def lerpHprVBase3(self, hpr, time, other=None,
blendType="noBlend", auto=None, task=None, shortest=1): blendType="noBlend", auto=None, task=None, shortest=1):
"""lerpHprVBase3(self, VBase3, float, string="noBlend", string=none, """lerpHprVBase3(self, VBase3, float, string="noBlend", string=none,
@ -663,7 +663,7 @@
return self.__lerp(functorFunc, time, blendType, task) return self.__lerp(functorFunc, time, blendType, task)
else: else:
return self.__lerp(functorFunc, time, blendType) return self.__lerp(functorFunc, time, blendType)
def lerpPos(self, *posArgs, **keyArgs): def lerpPos(self, *posArgs, **keyArgs):
"""lerpPos(self, *positionArgs, **keywordArgs) """lerpPos(self, *positionArgs, **keywordArgs)
@ -931,7 +931,7 @@
def place(self): def place(self):
base.startDirect(fWantTk = 1) base.startDirect(fWantTk = 1)
from direct.tkpanels import Placer from direct.tkpanels import Placer
@ -984,11 +984,11 @@
def posInterval(self, *args, **kw): def posInterval(self, *args, **kw):
from direct.interval import LerpInterval from direct.interval import LerpInterval
return LerpInterval.LerpPosInterval(self, *args, **kw) return LerpInterval.LerpPosInterval(self, *args, **kw)
def hprInterval(self, *args, **kw): def hprInterval(self, *args, **kw):
from direct.interval import LerpInterval from direct.interval import LerpInterval
return LerpInterval.LerpHprInterval(self, *args, **kw) return LerpInterval.LerpHprInterval(self, *args, **kw)
def quatInterval(self, *args, **kw): def quatInterval(self, *args, **kw):
from direct.interval import LerpInterval from direct.interval import LerpInterval
return LerpInterval.LerpQuatInterval(self, *args, **kw) return LerpInterval.LerpQuatInterval(self, *args, **kw)
@ -1041,10 +1041,10 @@
from direct.interval import LerpInterval from direct.interval import LerpInterval
return LerpInterval.LerpColorScaleInterval(self, *args, **kw) return LerpInterval.LerpColorScaleInterval(self, *args, **kw)
def attachCollisionSphere(self, name, cx,cy,cz,r, fromCollide, intoCollide): def attachCollisionSphere(self, name, cx, cy, cz, r, fromCollide, intoCollide):
from pandac import CollisionSphere from pandac import CollisionSphere
from pandac import CollisionNode from pandac import CollisionNode
coll = CollisionSphere.CollisionSphere(cx,cy,cz,r) coll = CollisionSphere.CollisionSphere(cx, cy, cz, r)
collNode = CollisionNode.CollisionNode(name) collNode = CollisionNode.CollisionNode(name)
collNode.addSolid(coll) collNode.addSolid(coll)
collNode.setFromCollideMask(fromCollide) collNode.setFromCollideMask(fromCollide)
@ -1052,10 +1052,10 @@
collNodePath = self.attachNewNode(collNode) collNodePath = self.attachNewNode(collNode)
return collNodePath return collNodePath
def attachCollisionSegment(self, name, ax,ay,az, bx,by,bz, fromCollide, intoCollide): def attachCollisionSegment(self, name, ax, ay, az, bx, by, bz, fromCollide, intoCollide):
from pandac import CollisionSegment from pandac import CollisionSegment
from pandac import CollisionNode from pandac import CollisionNode
coll = CollisionSegment.CollisionSegment(ax,ay,az, bx,by,bz) coll = CollisionSegment.CollisionSegment(ax, ay, az, bx, by, bz)
collNode = CollisionNode.CollisionNode(name) collNode = CollisionNode.CollisionNode(name)
collNode.addSolid(coll) collNode.addSolid(coll)
collNode.setFromCollideMask(fromCollide) collNode.setFromCollideMask(fromCollide)
@ -1063,10 +1063,10 @@
collNodePath = self.attachNewNode(collNode) collNodePath = self.attachNewNode(collNode)
return collNodePath return collNodePath
def attachCollisionRay(self, name, ox,oy,oz, dx,dy,dz, fromCollide, intoCollide): def attachCollisionRay(self, name, ox, oy, oz, dx, dy, dz, fromCollide, intoCollide):
from pandac import CollisionRay from pandac import CollisionRay
from pandac import CollisionNode from pandac import CollisionNode
coll = CollisionRay.CollisionRay(ox,oy,oz, dx,dy,dz) coll = CollisionRay.CollisionRay(ox, oy, oz, dx, dy, dz)
collNode = CollisionNode.CollisionNode(name) collNode = CollisionNode.CollisionNode(name)
collNode.addSolid(coll) collNode.addSolid(coll)
collNode.setFromCollideMask(fromCollide) collNode.setFromCollideMask(fromCollide)

View File

@ -5,11 +5,11 @@
""" """
def __repr__(self): def __repr__(self):
return '%s(%s,%s,%s)' % ( return '%s(%s, %s, %s)' % (
self.__class__.__name__,self[0],self[1],self[2]) self.__class__.__name__, self[0], self[1], self[2])
def pPrintValues(self): def pPrintValues(self):
""" """
Pretty print Pretty print
""" """
return "% 10.4f, % 10.4f, % 10.4f" % (self[0],self[1],self[2]) return "% 10.4f, % 10.4f, % 10.4f" % (self[0], self[1], self[2])

View File

@ -5,11 +5,11 @@
""" """
def __repr__(self): def __repr__(self):
return '%s(%s,%s,%s,%s)' % ( return '%s(%s, %s, %s, %s)' % (
self.__class__.__name__,self[0],self[1],self[2],self[3]) self.__class__.__name__, self[0], self[1], self[2], self[3])
def pPrintValues(self): def pPrintValues(self):
""" """
Pretty print Pretty print
""" """
return '% 10.4f, % 10.4f, % 10.4f, % 10.4f' % (self[0],self[1],self[2],self[3]) return '% 10.4f, % 10.4f, % 10.4f, % 10.4f' % (self[0], self[1], self[2], self[3])