0
$\begingroup$

I attached a sphere to a circle curve with the follow path constraint, but when i try to speed up and slow down the object with the "Path Animation > Frame" value with keyframes the object goes backwards at some point.

$\endgroup$

2 Answers 2

1
$\begingroup$

Instead of using a follow path constraint you can do this:

Add an empty in the world origin. Parent your sphere to it (Keep offset). Then animate the z-Rotation of the empty/sphere, which is much easier to use.

I've taken your blend file and parented the sphere to a rotating empty which is parented to an empty that's moving back and forth on the Y axis. The elliptical curve object is just to visualize the path of the sphere.

Your original sphere had an orbit with a diameter of 33.8 metres, so I set the sphere 16.9 metres away from the empty which makes a full rotation in 201 frames (to make it loop correctly on 200 frames). The second empty moves from Y = 3 m to Y = -3 m on frame 101 and back to Y = 3 m on frame 201.

This results in an elliptical movement which still has a diameter of 33.8 m on the major axis on the X axis, but the minor axis along Y is reduced by 6 m to 27.8, the Y distance that the second empty travels from one side to the other.

Because the rotating empty is 3 m away from the oscillating empty on the Y axis, the center of the elliptical movement is at X = 0 and Y = -3. (By the way, I've set the movement's interpolation to Bézier while the rotation is set to Linear, because otherwise the ellipse is somehow flattened on the short ends.)

This is because on frame 1 the sphere is on its lowest Y position and the osciallting empty is moving in negative Y direction at the beginning 8towards the sphere). If the sphere was on it highest Y position and the oscillating empty starts moving away from it, the ellipse diameter would be stretched in Y direction, exactly + 6 m.

If you start with the sphere in its lowest or highest X location, this will result in a slightly angled ellipse with different diameters (which can surely be calculated by formulas, but I don't have them at hand right now).

elliptical movement

$\endgroup$
9
  • $\begingroup$ Thanks for the idea, but i wanted to make more of an ellipse type of orbit. Is there a way to make the object orbit an empty in an ellipse (like a planet orbiting a sun)? $\endgroup$
    – Board2342
    Commented May 16, 2021 at 8:50
  • $\begingroup$ Yes, just parent the empty to another empty, which just moves on one axis back and forth $\endgroup$
    – Chris
    Commented May 16, 2021 at 9:47
  • $\begingroup$ I dont really get it, if i parent an empty to another empty and then parent the sphere to that, wont it just move in a circle too? Could you explain a bit further please? $\endgroup$
    – Board2342
    Commented May 16, 2021 at 10:08
  • 1
    $\begingroup$ @Board2342 Have you tried it? Because this is how it works. The more the second empty moves back and forth, the more elliptical the rotation will be. Although this won't help you if you want to speed up and slow down the movement. I guess in this case you have to slow down the rotation of the one empty and the movement of the second at the same time, because otherwise the sphere will be rather gyrating than rotating through space. But I guess this can be achieved quite easily. $\endgroup$ Commented May 16, 2021 at 10:44
  • $\begingroup$ @GordonBrinkmann Sorry, but i still dont really get it. I parented an empty to another empty and then parented a sphere to the second empty but when i either rotate the first or second empty, the sphere orbits in a circle. Im sure i missed something but i cant figure it out. $\endgroup$
    – Board2342
    Commented May 16, 2021 at 10:48
0
$\begingroup$

Sorry in advance, this will be a bit longer... Here is an explanation for the strange behaviour (which would happen with an open curve as well, the circle is not the reason): I guess after adding the Follow Path Constraint to your sphere, you've hit the Animate Path button under the target. What this does is creating a Generator Modifier on the curve which uses the Frames value under Path Animation to calculate the position where the sphere should be at a certain frame.

For example, the Generator Modifier is by default set to

y = -1 + 1x (where x is current frame and y the Evaluation Time)

To calculate how many percent of the curve the sphere should have been traveled, the Evaluation Time is divided by Frames. With Frames = 100 it takes 100 frames Evaluation Time for reaching 100% of the curve. IF you have an animation of 200 frames and since your curve is a circle, it can travel 200%, so twice the circle.

The -1 at the beginning of the formula ensures two things: at the start on frame 1, your sphere is on position 0% of the circle:

y = -1 + 1*1 = 0

-> 0 / Frames = 0 / 100 = 0 = 0%

At frame 51, your sphere traveled half the circle's circumference:

y = -1 + 1*51 = 50

-> 50 / Frames = 50 / 100 = 0.5 = 50%

If your animation runs for 200 frames, on the last frame you have

y = -1 + 1*200 = 199

-> 199 / Frames = 199 / 100 = 1.99 = 199%

So your sphere has not yet completed 2 full travels around the circle. This will be on frame 201 or in a looping animation back on frame 1, which makes the loop smooth.

Now you have set keyframes for the Frames value, 100 on frame 1, 25 on frame 30 and 100 on frame 60 again. Let's see what that means for the Generator Modifier.

Frame 1:

y = -1 + 1*1 = 0 as Evaluation Time with Frames set to 100, 0/100 = 0%.

Frame 30:

y = -1 + 1*30 = 29 as Evaluation Time with Frames set to 25, 29/25 = 116%.

So your sphere already traveled 16% more than once around the circle. Then comes Frame 60:

y = -1 + 1*60 = 59 as Evaluation Time with Frames set to 100, 59/100 = 59%.

In this case your sphere jumps back to 59% from 116%. And this problem will always occur when changing Frames, it doesn't matter if the curve is closed or open. Whenever the calculated position gets smaller than the position calculated before, it jumps back. Of course this can be intentionally, for example if you use a sine function to move something back and forth on a curve.

path modifier

$\endgroup$
1
  • $\begingroup$ Wow….didn‘t know that!! $\endgroup$
    – Chris
    Commented May 16, 2021 at 10:48

You must log in to answer this question.

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