0
$\begingroup$

Driver Expression Currently the ball in my file rotates for the entire duration of my animation. But I would like it to only start rotating at frame 375 and end at frame 700. Is there a code I have to add in the expression section of my driver? If yes can someone please explain to me how it works? Thank you.

$\endgroup$

1 Answer 1

0
$\begingroup$

If you want the rotation to be driven by scene time, that's just keyframing; no driver required.

But if you want the rotation to be driven by location on the curve-path, then you could construct an expression, perhaps involving lerp() and clamp(), relating the curve's eval_time to the X rotation of the ball.

However, it might be easier and more flexible to leave the eval_time as it is, and use the f-curve associated with the driver to draw the function relating the driving property on X to the driven property on Y:

enter image description here

With the right set-up (I have to set my driver-editor window to 'Stay On Top'), you can watch the animation while tweaking the f-curve. It's still fiddly, bit a lot less fiddly, IMO, than going backwards and forwards, tweaking values in a long expression.

enter image description here

Edit: (response to commentary)

You've got 2 methods of animating an object along a curve fighting one another. In your version:

  • The Evaluation Time of your curve is running continuously. The rotation of your ball is driven by that, so it's spinning continuously, too.
  • The ball is prevented from moving along the curve according to Evaluation Time by being set to 'Fixed Position' and having its Offset key-framed manually.

The location of the ball is ignoring Evaluation Time, the spin of the ball is not.

Either drive both the spin and the location by Offset, or both the spin and location by Evaluation Time. Personally I would prefer to drive both by Offset, forgetting the (legacy?) Evaluation Time altogether, to make the possibility of animating more than one object down the curve at different speeds cleaner.

But your driver uses Evaluation Time, so we'll go with that. In the adjusted version below, I've unchecked 'Fixed Position' on the ball, wiped its Offset key-frames, and, instead, key-framed Evaluation Time on the curve, imitating your previous locations as closely as I can, so now the location and spin are in sync.

$\endgroup$
11
  • $\begingroup$ nice explanation, but i assume he wants the ball to "physically" accurately roll on the curve no matter how long the curve is ;) But of course, this assumption has no proof and unfortunately he didn't describe this detail in his question $\endgroup$
    – Chris
    Mar 26, 2023 at 10:13
  • 1
    $\begingroup$ Hi, @Chris! You could be right, there, although I didn't read it that way. ... I guess we'll just have to wait and see. Maybe I'll wind up adding to my stash of deleted answers :) $\endgroup$
    – Robin Betts
    Mar 26, 2023 at 10:20
  • 1
    $\begingroup$ welcome to MY world!! :D $\endgroup$
    – Chris
    Mar 26, 2023 at 12:08
  • $\begingroup$ Hello everyone, @Robin-Betts, thank you for the explanation. The Problem with your simulation is the rotation of your ball, it is not constant. Chris is correct in his assumption, the ball must rotate accurately. The first 374 frames, the ball should remain stationary in it's position as a camera moves in to the appropriate place. At frame 375, the ball starts the path follow using the driver attached to the ball. At Frame 700, the ball arrives at the end of the path follow and stops rotating. $\endgroup$ Mar 26, 2023 at 12:47
  • $\begingroup$ Hello @Robin-Betts, how can i insert a blend file here? I believe this would help resolve my dilemma as it would become very clear and apparent after viewing viewing. Thanks again for your time, patience and understaNDING $\endgroup$ Mar 26, 2023 at 14:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .