Motionpath speed

attaboy hcvtec :wink:
just one thing: I guess the code chunks you provided are pretty of no use for other ppl in trouble therefore I made off a complete sample:

'''
summary: how to settle up a motion path with speed rate changeable dinamically
by: hcvtec and fabius astelix @ 2009-05
references: https://discourse.panda3d.org/viewtopic.php?p=38694#38694
instructions: shift the slider to the bottom with the left mouse button to change the smiley ball speed along the path.
'''
# Panda imports
import direct.directbase.DirectStart
from direct.directutil.Mopath import Mopath
from direct.interval.MopathInterval import MopathInterval
from direct.interval.MetaInterval import MetaInterval
from direct.showbase.DirectObject import DirectObject
from direct.gui.DirectSlider import DirectSlider
from direct.gui.OnscreenText import OnscreenText
from pandac.PandaModules import *

#=====================================================================
#
class World(DirectObject):
  #======================================================================
  #
  def __init__(self):
    #
    self.setup_scene()
    
    # 
    smiley = loader.loadModel('smiley.egg')
    smiley.reparentTo(base.render)
    smiley.setScale(.4)
    
    #** first off you need to instantiate a Mopath class and use it to load the curve
    self.mopath=Mopath()
    self.mopath.loadFile('my_mopath_curve.egg')

    #** then to setup an interval for the motion path...
    self.mpival=MopathInterval(self.mopath, smiley)
    #**  and another one to control the speed changes
    self.move = MetaInterval(self.mpival)
    
    # text and slider controls setup - see below the changespeed method to see how the motion path speed will be changed acting with the slider
    self.speed_control_text=OnscreenText(
      "", style=1, fg=(1,1,1,1), pos=(0.0, 0.2), scale=.04,
      mayChange=True, parent=base.a2dBottomCenter,
    )
    self.speed_control=DirectSlider(
      range=(0.001,3), value=0.001,
      command=self.changespeed,
      pageSize=1, pos = (0,0,-0.9), scale=.3,
    )
    self.speed_control.reparentTo(aspect2d)
    
    # this task will update the speed and such values
    taskMgr.add(self.show_speed,'show_speed')
  #------------------------------------------------------
  #
  def show_speed(self, task):
    s=self.speed_control['value']
    t1=self.mopath.getMaxT()
    t0=self.move.getT()
    self.speed_control_text.setText("s=(%0.3f)  t0=(%0.3f)  t1=(%0.3f)" % (s, t0, t1))
    
    return task.cont
  #------------------------------------------------------
  #
  def changespeed(self):
    self.move.pause()
    s=self.speed_control['value']
    t1=self.mopath.getMaxT()
    # if t0 reach t1 we reset it (NB: actually can't be 0.0 or will be issued an error)
    t0=self.move.getT() if self.move.getT() < t1 else 0.001
    self.move.start(startT=t0, endT=t1, playRate=s)
  #------------------------------------------------------
  #
  def setup_scene(self):
    # *** Setup lighting
    lightLevel=0.8
    lightPos=(0.0,-10.0,10.0)
    lightHpr=(0.0,-26.0,0.0)
    dlight = DirectionalLight('dlight')
    dlight.setColor(VBase4(lightLevel, lightLevel, lightLevel, 1))
    dlnp = render.attachNewNode(dlight.upcastToPandaNode())
    dlnp.setHpr(lightHpr[0],lightHpr[1],lightHpr[2])
    dlnp.setPos(lightPos[0],lightPos[1],lightPos[2])
    render.setLight(dlnp)
    
    # *** Setup scenery
    alight = AmbientLight('alight')
    alight.setColor(VBase4(0.2, 0.2, 0.2, 1))

    base.setBackgroundColor(0.2, 0.2, 0.7, 1.0)
    
    # axis origin
    axis=loader.loadModel('zup-axis')
    axis.setScale(.2)
    axis.reparentTo(render)
    
    # staring camera position
    base.mouseInterfaceNode.setPos(0.0, 26.0, 2.0)
    base.mouseInterfaceNode.setHpr(-4., 35., 1.0)
#-------------------------------------------------------
game=World()

if __name__ == "__main__":
  run()

you just have to provide a proper egg curve named ‘my_mopath_curve.egg’ and run it as usual