instantaneous interval

Hi gang, I’m trying to move a model over a period of time using an interval, but no matter what parameter I specify for time, the move is instantaneous. Can someone offer some advice?

PT(CLerpNodePathInterval) moveRowF= new CLerpNodePathInterval("swapRowF", 13.0, CLerpInterval::BT_no_blend, true, false, mynode, NodePath()); 
			
moveRowF->set_end_hpr(LVecBase3f(0,-10,-15));
moveRowF->start();

thanks

I don’t see anything wrong. Is it possible that you created this interval in the middle of a very long frame (for instance, at startup, or after loading a lot of models), so that by the time you reach the next frame, the required time has already elapsed?

(Note that the clock is by default as of the beginning of the current frame, so any time that has already elapsed this frame is deducted from your total run time.)

David

hmmm… no, but now that you mention it. I am calling it from inside an event handler, could that have something to do with it?

If so, what do you recommend I do? I need the keyboard to trigger this interval. Should I set a variable and make a task that checks it every frame?

There’s nothing wrong with calling it inside an event handler; that should work perfectly fine. There must be something else going wrong. For instance, maybe there’s some other task that’s resetting the position of the node before the interval gets a chance to run, or something equally silly.

David