6
$\begingroup$

I have a Curve Object and a vehicle following it using a Follow Path Constraint. I'm using the Fixed Position method and keyframing the Offset slider.

The problem is that I had to shorten my path and now the animation keyframes no longer match up (since they are based on the length of the curve). How can I know how much to rescale my keyframes by so that they will once again occur at their proper times?

Put simply, I want my vehicle to travel along the Curve at the same speed it did before, with the same acceleration/deceleration keyframe data, but adjusted to the new Curve length (stopping sooner).

Example

In this example the red block passes the finish line at frame 15, but the last Offset keyframe is at frame 51. Is it possible to delete the point on the curve beyond the finish line while still keeping the the animation data up to the finish line in tact?

How can we trim the curve so the red block doesn't go beyond the finish line - without altering the animation up to that point?

Here are the keyframes:

The keyframe locations

The curves of acceleration

So what happens if we delete the last point on the curve? The entire animation speed changes. What is the formula for correcting for this? How can we know what percentage to scale to in order to make it animate at the same speed it did before we deleted the tip point?

Deleting the tip point of this curve changes the speed as well

Is it possible that the keyframes' Y values needs to be scaled as well as X?

$\endgroup$
  • $\begingroup$ Why are you animating the offset of the follow path constraint? The curves path_duration defines how long it takes to move along the curve and the eval_time defines it's position at various times. $\endgroup$ – sambler Aug 24 '15 at 15:49
  • $\begingroup$ I'm still confused on what you are trying to do but let's see if I get this right... Originally you had an object that would travel to the end of the path in 51 frames... right? Now you want it to stop under the green F sign. Delete the other two keyframes you have so that you can go back to the original speed for the whole path. Move on the time line until your object reaches the point at which you want it to stop (around frame 32) and add a key frame there. At that point you can erase the very last keyframe. $\endgroup$ – cegaton Aug 25 '15 at 0:52
  • $\begingroup$ You do not need to change the follow path constraint curve. Just delete the unnecessary control points and the objects will rest at the last temporal one. Perhaps you wont mind the extra length of curve on the 3D View. I assume it is not for render. I may have some trouble understanding your question, Extra Curve seems less of a problem than missing curve. I sometimes pad extra curve at the beginning and end. $\endgroup$ – atomicbezierslinger Aug 25 '15 at 5:00
  • $\begingroup$ @sambler I'm animating the offset because it's easier two control the position. I can go to the keyframe I want, drag the slider until the object following is at the desired point, and keyframe it. Of the two methods I just find it more practical to animate by position than by evaluation time. $\endgroup$ – Mentalist Aug 25 '15 at 6:19
  • $\begingroup$ @cegaton Basically I wanted to know if a curve being used as a path can be altered significantly after the keyframing has been done. While it's not apparent whether scaling keyframes can accurately compensate for changes made to the curve, at least we seem to agree that handing the object off to a new curve is the most practical way to go. I'll end up with a long unused portion of a curve that looks a bit inelegant and confusing in my .blend but it won't be rendered and it doesn't matter ultimately. I just wanted to know if there was a cleaner way to do this. $\endgroup$ – Mentalist Aug 25 '15 at 6:31
3
$\begingroup$

enter image description here

enter image description here

Semi Quick Overview

When your path has multiple temporal/spatial milestones that can move, create a path and constraint for each, create [influence] keyframes, for maintainability in the future. Blender to the future. The more milestones you have the more maintainability is an issue.

In the images above in the 3D view the green ball has two follow path constraints. One path constraint to the yellow curve and one to the red curve. Positive constraint [influence] means, influence = 1. The graph window shows that the constraint [influence] on a frame, is 1 for only one constraint at most and switches discretely to 0 in one frame. The [influence] curve has four values [0,1,1,0]. When the [influence] is 0 the constraint has zero effect. The [offset] curve has two values[0,1]. The constraints can independently be deleted or (enabled/disabled with the eye) and the other one will have a predictable affect.

In the 3D View are two Bezier curves, red and yellow which visually appear continuous by position and slope. The two curves which were originally one and were [separated] to preserve slope/position continuity (piece wise continuous). The green ball first follows the yellow curve and then the red curve. The movement is smooth across curves. Speed continuity is reasonable because the constraint influence curve has value 1 for a designed range of frames.

Curves are different colors and have positive bevel for explanation purposes only. Curves need not be rendered. The image on bottom is to emphasize the graph [influence] values as they transition.

In this example I have repeated the location for one frame. Change the end [offset] to a number such as ( 1 - (1/[number of frames in range])) if this suits your goals.

Method 1 Verbose Discussion of above

  • If you will be changing paths often this work will be to your advantage.
  • Consider two or more contiguous paths. This will allow easier independent control of position and thus speed. Create a longer path from pieces of shorter paths. These paths will have influence on distinct ranges of frames/time and thus will ease the [Oh no! I have to change the path!] problem.

  • In the discussions below N1 and N2 are frame numbers such that 0 > N1 > N2 and N2 > N1 + 2. We use the names path 1 and path 2. FrameRange0110(f1, f2) means [influence] keyframes set on four frames. 0 > f1 and f2 > (f1 + 1), that is the range is two keyframes at least long for ease of discussion. Frame (f1-1) = 0. Frame f1 = 1. Frame f2 = 1. Frame (f2 + 1) = 0. Four [influence] values [0,1,1,0] listed in increasing order of (frame or time). FrameRange0110(f1, f2) also means constraint [offset] values which are Frame f1 = 0 and Frame f2 = 1. Two values indicating beginning and end of curve [0,1]. Every FrameRange0110(<.>, <.>) denotes 6 keyframes.

  • Independent Frame Ranges. Lets also call two Frames ranges A = FrameRange0110(s1, e1) and B = FrameRange0110(s2, e2) Independent, if the positive [influence] values do not overlap in frame or time. Either (e1 < s2) or (e2 < s1). The 0 [influence] of one range may exist with the positive [influence] of another range, which should be the case for this particular example.

  • Action. For path constraint 1 with curve 1 create Range 1 = FrameRange0110(1, N1).

  • Action. For path constraint 2 with curve 2 create Range 2 = FrameRange0110(N1 + 1, N2)

  • Range 1 and Range 2 are now independent frame ranges and have convenient control.

  • This can be extended to many curves so long as the all path constraints are pairwise independent. Make small adjustments to suit your needs. Once you get independent control you might try some advanced mix of influence for interesting results.

  • To edit the range of influence for two adjacent curve you can select 4 adjacent points in two contiguous ranges in the Graph Window and move them in the X direction respecting the notion of Frame Range independence.

Advanced

  • In certain circumstances visual objects can control the Bezier curve itself.

  • By using [influence] keyframes with two curves and no independence one can add circle wobble which is different than the curve noise modifier. The second curve could just be a circle or other closed curve with curve cycles modifier. Curve placement is being added.

Beware

  • It is not clear that simple scaling of dopesheet frames will produce acceptable/predictable results. I have not seen documentation of how parametric distance is calculated in Blender. Complications are Bezier versus Path. Similar mathematical information is published in computer graphics books. It might be difficult to determine which particular method Blender uses.
  • Looking at source code may be more difficult than Method 1.

Method 2 (Superstitious)

  • Reflect on the likelyhood of further path changes. If you believe no further changes are coming then just use the new curve and set new keyframes. You have only doubled your work for this task.
$\endgroup$
  • $\begingroup$ Thank you for the detailed answer! I'm with you on the handing off between multiple curves technique. Actually my project uses this technique - one curve path for each camera shot, the idea being that once a shot is done I don't want to have to change the curve as it would affect the animation. The reason I asked this question is I decided to break up a particularly long curve into 2 shots, hence 2 curves, and once the length was altered I was unable to get the animation back as it was. But I think the solution will be not to cut and instead hand off via "influence" midway to a new curve. $\endgroup$ – Mentalist Aug 25 '15 at 5:58
  • $\begingroup$ I didn't understand this part of your answer: "In the discussions below N1 and N2..." And maybe it's not necessary to. But if you could clarify I would like to understand. $\endgroup$ – Mentalist Aug 25 '15 at 6:02
  • $\begingroup$ To address this point: "It is not clear that simple scaling of dopesheet frames will produce acceptable/predictable results. I have not seen documentation of how parametric distance is calculated in Blender." - This is what I was most curious about. I wanted to know if I was scaling the wrong way, or doing the math wrong, or if there is simply no accurate way for us to calculate it. If anyone knows more about this, I invite their comments. In the meantime I know what I need to in order to move forward, and I accept your answer. Thanks again! You are quite the bezier slinger. $\endgroup$ – Mentalist Aug 25 '15 at 6:07
  • $\begingroup$ @Mentalist . I long ago, (1.5 year) tried to understand what model is used for parametric distance. Only for Bezier. I thought it might be Calculus Line Integral distance. Perhaps Bezier segment and Calculus Line integral distance. Because Blender is like Pandoras box I also stopped trying. I simply had to move on to other work. I was a hesitant to investigate again in the interest of time today. Maybe I should start a new investigation. Yet we know that constraint [influence] has a clear result for your task today. I do not understand how one curve per camera shot is useful. $\endgroup$ – atomicbezierslinger Aug 25 '15 at 6:51
  • $\begingroup$ @Mentalist. N1 and N2 are more mathematical descriptions that I lapsed into in a math stupor. If you understand the picture you have the honor of skipping that gooey slop. $\endgroup$ – atomicbezierslinger Aug 25 '15 at 6:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.