6 Replies Latest reply on Feb 3, 2016 6:45 PM by Rick Gerard

    auto orient causing my cars to shake, jitter, wriggle uncontrollably

    russell888

      I am animating cars driving around an intersection. But the auto orientation causes them to shake uncontrollably. I have been searching for an answer but with no luck.

       

      I rendered 7 seconds of the video so you can clearly see it here. test car intersection - YouTube

       

      Just for tag purposes:

      wriggle jitter shake jump jittering wriggling problem

        • 1. Re: auto orient causing my cars to shake, jitter, wriggle uncontrollably
          Szalam Adobe Community Professional & MVP

          Check the rating you've given that video and some of the other YouTube settings. I can't watch it with "Restricted Mode" turned on, so I can't see your example.

           

          That being said, can you show us a screenshot with one of your vehicles selected and press UU so we can see its motion path and all of the changed parameters?

          • 2. Re: auto orient causing my cars to shake, jitter, wriggle uncontrollably
            russell888 Level 1

            Hi Szalam, since I posted that I have almost found a solution but I still need a little help.


            Instead of using Auto-Orient I am going to use this expression in Rotation which seems to fix everything and make it follow the path nice and smoothly.

             

            The problem is the expression makes my car rotate -180 degrees when moving and then snap back to it's default rotation when stationary. It looks like this:

            example66.jpg

            9741_9734testcarfollowleader.aep.zip

             

            Here is the expression.

             

            cornerEase = 2; // sets the amount to look ahead and behind for gradual turns

             

             

            pre = position.valueAtTime(time-thisComp.frameDuration*cornerEase);

             

             

            post = position.valueAtTime(time+thisComp.frameDuration*cornerEase);

             

             

            delta = post-pre;

             

             

            if (delta[0] == 0 && delta[1] == 0) {

             

             

            // if there is no change in vector maintain the current heading

             

             

            rotation;

             

             

            }else{

             

             

            // use the vector direction to orient. Flip the Y to account for cartesian Y being up and AE Y being down

             

             

            radiansToDegrees(Math.atan2(delta[0],-delta[1]));

             

             

            }

             

            Thanks to Jared at mindfury.com for this expression.

            • 3. Re: auto orient causing my cars to shake, jitter, wriggle uncontrollably
              Szalam Adobe Community Professional & MVP

              Don't let it sit perfectly still. Make it move a tiny fraction of a pixel otherwise it doesn't know where to face. Either that or change the actual rotation value so that it's pointing the correct direction.

              • 4. Re: auto orient causing my cars to shake, jitter, wriggle uncontrollably
                russell888 Level 1

                I've made it move a fraction of a pixel when "stopped" that's such a simple fix! Thanks.

                • 5. Re: auto orient causing my cars to shake, jitter, wriggle uncontrollably
                  Szalam Adobe Community Professional & MVP

                  No problem! Don't forget to mark the post with the correct answer so that other forum searchers will find the answer quickly.

                  • 6. Re: auto orient causing my cars to shake, jitter, wriggle uncontrollably
                    Rick Gerard Adobe Community Professional & MVP

                    There is a flaw in that expression. If the layer (car) is moving horizontally and ends up parallel to the edges you can eliminate the flip by temporarily disabling the expression and chanting the rotation value of the layer to 90º. Re-enable the expression. This will stop the flip. 

                     

                    Change the movement to horizontal and again you can fix the rotation problem by resetting the position value but the car will not stay in the right position unless the bezier handle for the last keyframe is either horizontal or vertical. The only way to get this expression to work correctly is to set the angle of the car to precisely match the angle of car relative to the path at the last position keyframe by adjusting the rotation value and then cycle expression on and off. The little trick of adding another keyframe and changing position a little bit is no real work around because results are very spotty. If the car is stationary, then starts to move, then comes to a stop you need to match the rotation angle at the start and end of the path to avoid a lot of weird behavior. The expression you are using is just not a very elegant solution. I would say that it just doesn't work without a bunch of fussing around unless your movement is horizontal or vertical. If you really want to use the expression I would simply pre-compose the layer moving all attributes then enable time remapping for the pre-comp and set a time remapping keyframe where the car stops and delete the one at the end of the layer.

                     

                    The original problem was probably caused by bezier handle problems in the motion path. A much simpler approach would be to make sure your bezier handles are correct and simply orient along a path.

                     

                    If you want to use an expression and get an accurate and editable "look ahead" for turns is to simply add a null that follows the path you want the car to take and use a look at expression to have the car look a little ahead of the curve. The final position of the null can be moved just ahead of the resting position of the car to make things work out. The amount of look ahead can be adjusted by editing the speed graph for the null. it's a lot easier and more predictable. It's especially easy with 3D layers.