Esempio n. 1
0
    def __init__(self,
                 nodePath,
                 pos,
                 durationFactor=0.2,
                 startPos=None,
                 other=None,
                 blendType='noBlend',
                 bakeInStart=1,
                 fluid=0,
                 name=None,
                 lookAtTarget=True,
                 duration=None):
        self.nodePath = nodePath
        self.pos = pos

        if type(pos) != type(Point3()):
            self.notify.warning(
                "pos argument must be of type %s, not of type %s" %
                (type(Point3()), type(pos)))
            return None

        if nodePath.isEmpty():
            self.notify.warning('You must specify a non-empty NodePath!')
            return None

        if duration is None:
            _distance = (pos.getXy() -
                         (nodePath.getX(), nodePath.getY())).length()
            duration = _distance * durationFactor
        LerpPosInterval.__init__(self, nodePath, duration, pos, startPos,
                                 other, blendType, bakeInStart, fluid, name)
        if lookAtTarget:
            self.nodePath.headsUp(self.pos)