On the next frame I want to position the object a bit further on the spline, thus increase the spline offset a bit and replace the object.
Now is my question, how to get the spline offset using the objects position?
Below the code I use at this moment.
It seems ok for a straight spline, but when I change (round) the spline a bit, something goes wrong.
spl = op[c4d.ID_USERDATA, 3] #spline link
sh=SplineHelp() #Add an instance of the spline helper class
sh.InitSpline(spl) # initialize spline
#get offset on spline based on object position
pos0 = sh.GetPosition(0) # get 'origin' position spline offset=0
objmtx = current_object.GetMg() # Get the object's global matrix
diff = objmtx.off # get object position
dist = (diff-pos0).GetLength() # get difference between spline origin and object
currentoffset = sh.GetOffsetFromUnit(dist) # get offset on spline