About ParentInterval in the FunctionInterval module

Can someone tell me how to use the ParentInterval function in the direct.interval.FunctionInterval module?
I have tried many methods and cannot use this function。
I referenced FuncInterval, but there is still AttributeError: ‘panda3d. core. NodePath’ object has no attribute ‘ParentInterval’

Indeed, it seems that “ParentInterval” is a class on its own, with no convenience function available from NodePath in order to make one.

That is, you might create one like so, I believe:

# I'm here including another type of interval to illustrate that
# this is a general approach to using intervals
from direct.interval.IntervalGlobal import ParentInterval, LerpPosInterval
from panda3d.core import NodePath, PandaNode

myChildNodePath = NodePath(PandaNode("child node"))
myParentNodePath = NodePath(PandaNode("parent node"))

myParentInterval = ParentInterval(myChildNodePath, myParentNodePath)

Thank you for your reply. By imitating the example of the solar system and using the attachNewNode() function to bind to the parent model, I achieved the desired effect.

1 Like