I am trying to animate a rollercoaster along a curve. Each point of the curve has an attribute when the train will arrive at the specific point. But the obvious formula of "timeAtPointX / totalTime" does not work when put in a carve node U and the speed does not change at all when the train drops down.
Can anyone help me solve the problem with the carve node? I am also fine with not using a carve node, as long as my 5 car train rolls along the track with the calculated speed.
Here is a somewhat convoluted solution. Attributes are fetched from points and converted to keyframes that drive the carve node. Each point contains an arrival time in seconds. Behind it all is the python based fit function for Houdini.
Okay, first of all, really big thanks to you @Enivob! This is a really clever way, setting keyframes via python. Would never have come up with this on my own.
However I did some minor debugging and tweaked the code a bit, since your result produced a linear keyframe ramp which had the same speed between all points. In case somebody else should ever need this, I ended up with this:
pcount = 0 #calulate amount of points for point in geo.points(): pcount = pcount + 1 numpt = pcount
count = 0 for point in geo.points(): #loop through all points and set keyframes in the specified carve node count = count + 1 value = point.attribValue('time') keytime = value key.setFrame(keytime/finaltime*lastframe) key.setValue((count/numpt))#+(keytime/finaltime) parm.setKeyframe(key)