6
$\begingroup$

enter image description hereJust trying to do my first animation and am struggling to make it loop seamlessly. I think the differing rotational speeds of the 2 objects are the thing to overcome but I'm not sure how. I basically want the earth to do one revolution to the teapot's 2 orbits around the earth.

Can anyone have a look at this and advise me?

Thanks in advance.

$\endgroup$
7
  • $\begingroup$ +1 For uploading a .blend to the right website and just having 5 rep, I haven't seen that before $\endgroup$
    – WhatAMesh
    Commented Sep 13, 2018 at 13:56
  • $\begingroup$ I try to do my best ;) $\endgroup$ Commented Sep 13, 2018 at 13:57
  • 1
    $\begingroup$ To go somewhat in other direction, can you explain what and how you want objects to loop without the need to download a 30Mb file. Basically if you want 1 revolution to loop in N frames, make the object have same transform in frame N + 1 as in frame 1. For two objects having differing revs, If one object does a full revolution in 7 frames and another in 5, use the lowest common multiple of frames, (in this case) 35. $\endgroup$
    – batFINGER
    Commented Sep 13, 2018 at 14:14
  • 2
    $\begingroup$ Without opening your .blend (it would be good if you could update your question will some images), how are you animating the rotation? Are you just using keyframing for the rotation? Have you tried using Generate modifier in the graph editor? Generate would let you define an actual rotation speed rather than having to do them 'by eye' and you could then easily use mutipliers with a common factor (such as 0.15 and 0.2) which would naturally give you seamlessness. $\endgroup$ Commented Sep 13, 2018 at 14:14
  • 1
    $\begingroup$ Sorry, screenshot added. I'm new to this so just eyeballed it in keyframes. Haven't used the Generator modifier before. I basically want the earth to do one revolution to the teapot's 2 revs. $\endgroup$ Commented Sep 13, 2018 at 14:30

3 Answers 3

4
$\begingroup$

Driver Based approach.

enter image description here

For the planet I have added a driver to its z rotation.

 pi * frame / 40

where frame is known to the driver namespace as the current frame. The rotation is 0 degrees at frame 0 and 360 degrees (2pi radians) at frame 80.

A satellite object and an orbit circle is added. A follow path constraint, with follow curve and fixed position. enter image description here

The driver is added to the offset.

(frame / 40) % 1.0

At frame 0 and frame 40 will be at 0 and 1 offset (same position) respectively. The % is python modulus, ie the remainder when divided by one. Related

Ok so now have a planet that revolves once in 80 frames and a satellite that orbits every 40 frames.

To loop the animation, set 1 and 80 as start and end frames.

$\endgroup$
2
$\begingroup$

In order to get a fixed and repeated rotation you can use the f-curve 'Generate' modifier. This allows you to define an equation (that you can precisely tune for the required rotation) for the f-curve rather than basing on keyframes.

generate modifier

To achieve this, once you have added a single keyframe, open the Graph Editor and select the relevant channel (eg, Z-rotation). In the Modifiers panel, select Add Modifier and select 'Generator'.

Set the polinomial to '1' since we want a straight line. The generator defines an equation as y = c + mx where c is a constant and m the multiplication factor for the x value (effectively the 'frame' of the animation).

The rotation is measured in radians - so 2xPi radians is a full rotation.

In order to have your object to make a complete rotation in, say, 50 frames you should enter the 'x' multipler ("coefficient for polynomial") to 2*pi/50 (just type that into the field and press Enter - Blender will calculate it for you and show the result (0.126 in this case)).

Repeat for the other object but choose a suitable number of frames (so there's a common factor). For example, 50 frames for one object and 100 for the other will result in them both getting back to their start rotation after 100 frames.

For your situation with an object orbiting the planet you could setup similar to the following :

scene

In the scene there is a Cube (planet), Suzanne (moon) and Empty (to act as the centre of the moon's orbit). Suzanne is a child of the Empty (select Suzanne, hold Shift, select Empty, press Ctrl+P and choose 'Object' - so rotating the empty will move Suzanne around the orbit.

Now select each object in turn (Cube, Suzanne, Empty) and add a keyframe on the Z-rotation.

Select the Cube, open the Graph Editor (as detailed above), add a Generator modifier and set the X coefficient to 2*pi/100 (rotate once per 100 frames).

Repeat for the Empty but set the coefficient to 2*pi/50 (rotate once per 50 frames).

Repeat for Suzanne to set the rotation of the 'moon'.

animated

$\endgroup$
4
  • $\begingroup$ Ah, I think I may have worded my question incorrectly. When I say rotation I meant The Earth rotating and the Teapot orbiting around it. $\endgroup$ Commented Sep 13, 2018 at 15:10
  • 1
    $\begingroup$ @RossingtonSteele No worries - same principle applies, just a different centre of rotation. Simplest option to have it orbit the planet would be to add an Empty at the same location as the planet and 'parent' it to the teapot (so the teapot is a child of the Empty). Rotating the Empty will then result in the teapot orbiting the Empty and can be at a different rate to the planet. You can then independently rotate the teapot. Use the above technique for each of the rotations and you can keep them 'in step' so that they get back to their starts at the relevant frame for the looping. $\endgroup$ Commented Sep 13, 2018 at 15:30
  • $\begingroup$ @RossingtonSteele Updated answer to include setting up the orbit. $\endgroup$ Commented Sep 14, 2018 at 5:51
  • $\begingroup$ Not adding her fcurve will put Suzanne in a fixed orbit to avoid seeing "The dark side of the Monkey" $\endgroup$
    – batFINGER
    Commented Sep 16, 2018 at 14:01
1
$\begingroup$

Alternative Driver-based Solution

I used this question as an exercise to familiarize myself with drivers. The solution turned out well enough and different enough from the others that I figured I'd post it. I couldn't say whether it has any particular advantage or disadvantage compared to the other driver answer; it's just what I came up with. :)

This is a driver-based solution built on Script Expressions that uses only the primary objects (planet + satellite, no empties or curves).

In preparation use keyframes to animate the "planet" object so it does one rotation around the Z-axis over the course of the animation.

The drivers all target the satellite (Suzanne) and are all based on the planet's rotation. We need at least two: one for the satellite's X location and one for its Y location. If we want the satellite to have a synchronized orbit such that the same side always faces the planet then a third driver targets the satellite's Z rotation.

I created each driver by hovering over the appropriate field in the Object tab in the Properties window, entered Ctrl+D, and selected Manually Create Later (Single). (In 2.8x this will pop a dialog. Just dismiss it by moving mouse away.)

add drivers to object fields

Next, open the Graph Editor (1) (in 2.8x choose Drivers rather than Graph Editor), select one of the drivers from the left panel (2), open the Properties drawer (N) and click the Drivers tab (3).

graph editor steps

Create a variable (4) with these attributes (5):

Type: Transform Channel
Name: planetZRot
Object: Planet
Type: Z Rotation
Space: World

Now copy this variable to the other drivers using the "arrow & clipboard" buttons (6).

Configure each driver to have type Scripted Expression (7). The expressions for each of the drivers are as follows.

  • X Location: 0 + (cos(planetZRot * m)) * r
  • Y Location: 0 + (sin(planetZRot * m)) * r
  • Z Rotation: planetZRot * m

Here m is Srot / Prot, the ratio of the satellite's rotation to the planet's rotation and r is the radius of the orbit.

Result with m=2 and r=3...

render with m=2 r=3

$\endgroup$

You must log in to answer this question.

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