Пример #1
0
    def doMoveTrack(self,
                    path,
                    turnToFirstWP=True,
                    speed=3.0,
                    doWalkAnims=True):
        self.clearMoveTrack()

        #for pos in path:
        #    smiley = loader.loadModel("models/smiley.egg.pz")
        #    smiley.reparentTo(self.pathVisRoot)
        #    smiley.setPos(pos)
        #    smiley.setTextureOff(1)

        self.moveTrack = CIGlobals.getMoveIvalFromPath(self, path, speed)

        if turnToFirstWP:
            turnHpr = CIGlobals.getHeadsUpAngle(self, path[1])
            turnDist = CIGlobals.getHeadsUpDistance(self, path[1])
            if doWalkAnims:
                self.moveTrack.insert(0, Func(self.playWalkAnim, 1.0))
            self.moveTrack.insert(
                1,
                LerpHprInterval(self,
                                duration=turnDist / (speed * 30),
                                hpr=turnHpr))
            if doWalkAnims:
                self.moveTrack.insert(2, Func(self.playWalkAnim, 1.5))
        elif doWalkAnims:
            self.moveTrack.insert(0, Func(self.playWalkAnim, 1.5))

        self.moveTrack.append(Func(self.playIdleAnim))
        self.moveTrack.start()
Пример #2
0
    def doMoveTrack(self,
                    path,
                    turnToFirstWP=True,
                    speed=3.0,
                    doWalkAnims=True):
        self.goon.d_doMoveTrack(path, turnToFirstWP, speed, doWalkAnims)

        self.clearMoveTrack()

        self.moveTrack = CIGlobals.getMoveIvalFromPath(self.goon, path, speed)

        if turnToFirstWP:
            turnHpr = CIGlobals.getHeadsUpAngle(self.goon, path[1])
            turnHpr[0] = PythonUtil.fitDestAngle2Src(self.goon.getHpr()[0],
                                                     turnHpr[0])
            turnDist = CIGlobals.getHeadsUpDistance(self.goon, path[1])
            self.moveTrack.insert(
                1,
                LerpHprInterval(self.goon,
                                duration=turnDist / (speed * 30),
                                hpr=turnHpr))

        self.moveTrack.append(Func(self._moveTrackFinished))
        self.moveTrack.start()
        self.moving = True
 def isPlayerInVisionCone(self, plyr):
     # Is the player in my angle of vision?
     angle = CIGlobals.getHeadsUpDistance(self.suit, plyr)
     return abs(angle) <= self.MaxVisionAngle