Panda 3D updating end HPR in Lerp interval

318 views Asked by At

So Panda3D has this option to update the starting position of a Lerp interval by using the parameter "bakeInStart", if we set it equal to 0. However, I can't find a solution to overcome this problem, which is updating the end HPR (yaw, pitch, roll) value each time there is a new iteration of the Lerp interval loop. I've managed to work around this to get the desired effect, but a whole screen of code had to be written (because of multiple intervals written in sequence). I've tried this so far to minimize code:

self.rotateTargets(0)

def rotateTargets(self, angle):

    # Create Lerp intervals for each target orbit node to rotate all of the targets
    # in a parallel sequence with easing
    self.angle = angle

    self.rotateTargets = Sequence(
        Parallel(
            LerpHprInterval(self.orbitNodes["orbit0"], 4, Point3(0, 0, self.angle+90), blendType = "easeInOut", bakeInStart = 0),
            name = "rotateTargets0"), Func(self.targetReparent(self.orbitNodes["orbit0"].getR())) 

self.rotateTargets.loop()

def targetReparent(self, newAngle):

    # Define new angle
    self.newAngle = newAngle
    self.angle = self.newAngle

An assertion error appears in the console, but it is related to the imported functions, and not my code.

0

There are 0 answers