As shown in the following code, I want to implement the interval between each time the character achieves a random change of position. But there is no way to achieve it using various methods. Although the random setting of the character position is now implemented, during the execution interval, the character still returns to the original position before moving. I saw that the document has stated that the engine does not affect the position of the moving node, but it moves after changing the position of the character. Why?
from panda3d.core import * import direct.directbase.DirectStart import random from direct.interval.IntervalGlobal import * from direct.actor.Actor import Actor window = WindowProperties() base.win.requestProperties(window) base.setBackgroundColor(0.5,1,1) envir = loader.loadModel('environment') envir.reparentTo(render) ss = Actor('panda') ss.reparentTo(render) ff = ss.posInterval(2, pos=(ss.getX(), ss.getY(), ss.getZ()-10)) def change(): global ff ll = (random.randint(-10, 10), random.randint(-10, 10), 0) ss.setPos(ll) kk = Func(change) Sequence(ff,kk).loop() base.run()