Skip to main content
Inspiring
July 10, 2021
Answered

Auto orient to path somethings turns off and "flips" images for a frame or two - how do I stop that?

  • July 10, 2021
  • 3 replies
  • 6305 views

Hi

 

I have a comp within a comp. The inner comp has a static character moving on a circular path, Auto-Orient on.

 

The character has some other characters following it using the following expression:

 

var P=thisComp.layer(index-1).transform.position;
var D=thisComp.layer("Adjustment Layer 1").effect("Slider Control")("Slider")*thisComp.frameDuration;
P.valueAtTime(time-D)

 

It all works well. However, there are about a dozen times where the followers forget that Auto-Orient is on and un-orients themselves - not all at once - one here and there, sometimes 2 or 3 followers at once - almost randomly, although it happens in the same places when I scrub through. 

The leader character is fine - no flipping out of Auto-Orient mode.

 

The end result is 90% of the time it looks great, but the rest of the time it's flickering as different images flip for a frame or two.

 

I can't see any rougue keyframes that might be doing this.

 

The other weird thing is that it seems to do it more often when play from the main project comp. When in the inner comp, it still does it, but not as often.

Any idea what might be causing this?

 

Thank you.

This topic has been closed for replies.
Correct answer Rick Gerard

I see a couple of organizational problems with your project. The first and most obvious problem is that you put an effect control slider on an adjustment layer. Effects Control sliders should not be on adjustment layers unless they are controlling effects on that adjustment layer. It's a waste of a layer that gets looked at when rendering.

 

Second, your expression is recursive. You should be pointing to one layer, your master animated bird layer, and adjusting the time delay based on the layer index. Dan Ebberts has the solution for you over at Motionscript.com

 

I would put the expression control slider on the bird layer and use this expression:

src=thisComp.layer("Bird 1");
delay = thisComp.layer("Bird 1").effect("Delay")("Slider"); //number of frames to delay

d = delay*thisComp.frameDuration*(index - 1);
src.position.valueAtTime(time - d)

 

You could add some randomness to the delay by modifying the expression with a random number. As long as the original motion path is clean, that should solve your problem.

 

3 replies

Rick GerardCommunity ExpertCorrect answer
Community Expert
July 10, 2021

I see a couple of organizational problems with your project. The first and most obvious problem is that you put an effect control slider on an adjustment layer. Effects Control sliders should not be on adjustment layers unless they are controlling effects on that adjustment layer. It's a waste of a layer that gets looked at when rendering.

 

Second, your expression is recursive. You should be pointing to one layer, your master animated bird layer, and adjusting the time delay based on the layer index. Dan Ebberts has the solution for you over at Motionscript.com

 

I would put the expression control slider on the bird layer and use this expression:

src=thisComp.layer("Bird 1");
delay = thisComp.layer("Bird 1").effect("Delay")("Slider"); //number of frames to delay

d = delay*thisComp.frameDuration*(index - 1);
src.position.valueAtTime(time - d)

 

You could add some randomness to the delay by modifying the expression with a random number. As long as the original motion path is clean, that should solve your problem.

 

Shaun5FC3Author
Inspiring
July 12, 2021

The expression works really well Rick, and the slider on the lead character makes spacing the followers easy. Thank you.

 

However, I'm trying to get the followers to follow the rotation of the leader (not at the same time it rotates, but in the same place in the path it rotates).

 

Adding the extra line at the end is throwing an the error "expression result must be of dimension 2 not 1":

 

src=thisComp.layer("Leader");
delay = thisComp.layer("Leader").effect("Delay")("Slider");
d = delay*thisComp.frameDuration*(index - 1);
src.position.valueAtTime(time - d);
src.rotation.valueAtTime(time - d);

 

What is wrong with that expression please?

Community Expert
July 12, 2021

If you are applying that expression to position you have to delete the last line. 

If you are applying that expression to rotation then you need to delete the next to the last line.

 

If the layers have auto-orient to path turned on you don't need to fiddle with rotation. 

 

If you need further help please embed a screenshot showing the modified properties of the layer giving you problems. Select the layer, press 'uu', and embed the image. If you can't see it when you make your post it's a pain for us to look at it. 

 

You also need to spend some time with the User Guide and the AE user manual and learn how to write expressions and what arrays are.

 

* The "Drag & Drop here..." area is buggy and should not be used to share images. Please use the toolbar or just drag your images to the reply field.

Shaun5FC3Author
Inspiring
July 10, 2021

Another oddity - if I play the comp from the main comp, the flips happen in different places to where they happen if I play back within the comp.

ShiveringCactus
Community Expert
Community Expert
July 10, 2021

Are you using Collapse Transformations?  And is there a camera in both comps?  These would explain why they happen in different places, I think.

 

Can you post a screenshot of the whole project?

Andjust to clarify, I'd hadn't mean to suggest removing the valueAtTime, I'm suggesting removing the auto-orient on the follow layers and see if that makes a difference.

Shaun5FC3Author
Inspiring
July 10, 2021

No Collapse Transformations. I just tried it with them trurned on, and same issue.

 

I'm new to AE, but I'm working in 2D, not 3D, so does that mean no cameras at all? I can't see a movie camera icon in the preview window.

Lol! I totally misunderstood re valueAtTime. Just tried turning Auto-Orient off, and the problem goes away, but I'm left with un-oriented characters.

I've attached 2 screenshots - I hope I've captured the relevant info. the first shows it behaving correctly, then misbehaving 1 frame later - the last two baby doves have flipped out of auto-orient

Thank you!

Shaun5FC3Author
Inspiring
July 10, 2021

I forgot to mention that Auto-orient is on for all the followers.

ShiveringCactus
Community Expert
Community Expert
July 10, 2021

hmm, that's an odd one.  Could it be the valueAtTime is causing an issue with the auto-orient, as in it's trying to do both and that's causing the flipping.  To be honest, I don't see why it should, but it might be worth seeing what happens if you disable it for the follow characters.

It's also strange that it happens randomly.  Can you try moving through the timeline frame-by-frame and then rock back and forth across a point where one flips.  A clue as to what's happening might emerge.

Shaun5FC3Author
Inspiring
July 10, 2021

Thanks ShiveringCactus

 

The follows stop following when I disable valueAtTime.

 

I shouldn't have described it as random - it happens in the same places each time.

 

I've checked all the layers, and there's no rouge keyframes where it's happening.

I thought it might have had something to do with the vertex points, but I can make it happen when neither the leader nor any followers are on any vertexes.