ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Rotate object in absolute axis, not its own

COW Forums : Adobe After Effects

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Juan Irache
Rotate object in absolute axis, not its own
on Oct 8, 2019 at 1:27:00 pm

Hi,

I have been fighting with this seemingly simple problem: I want to rotate an object based on external data. The rotation should always happen in the same axes in relation to the viewer, that is, the x axis should create vertical rotation, y should do horizontal rotation and z should do "clock-like" rotation. The problem is, when you rotate an object, its axes change position, so if you rotate, say Z after having rotated around Y, Z rotation looks like Y rotation. Not sure if I'm explaining this right.

I thought I could solve this by orbiting a camera around my object, by parenting it to a null object placed in the center that performs the rotation. That way the Z axis is preserved, but X and Y still get mixed up.

Here's a short video showing what I mean:





I think the mathematically correct way to solve this is using quaternions. But 1) I don't know them well enough 2) It seems overkill to code a very long expression, with classes and things like that, just to solve this.

I'm probably not the first to face this problem, has anyone got experience with something like it?

Thanks!


Return to posts index

Juan Irache
Re: Rotate object in absolute axis, not its own
on Oct 8, 2019 at 5:49:08 pm

What baffles me the most is why the second rotation in the "orbiting camera" version does not happen around the X axis (red arrow) but around Z (blue):







(this is the front view of the static object, the arrows are on the null object the camera is parented to)

It looks like when X or Y are rotated, Y or X will not rotate around the arrow any more. What are they rotating around then? This is getting very confusing.


Return to posts index

Michael Szalapski
Re: Rotate object in absolute axis, not its own
on Oct 8, 2019 at 7:36:34 pm

If you have a chain of nulls. One for each axis (or maybe two nulls and your regular object) with each one parented to the next, you can get rotation always in the desired axis.

- The Great Szalam
(The 'Great' stands for 'Not So Great, in fact, Extremely Humble')

No trees were harmed in the creation of this message, but several thousand electrons were mildly inconvenienced.


Return to posts index


Juan Irache
Re: Rotate object in absolute axis, not its own
on Oct 8, 2019 at 8:22:28 pm

No, unless I'm doing something very wrong, the rotation of the top null affects the rotation of the middle null, and this one affects my object (it has to, that's the point). Then the axis directions are different from the inital ones and the object does not rotate around world axes:







Z and X are reversed at the end of the animation


Return to posts index

Greg Gesch
Re: Rotate object in absolute axis, not its own
on Oct 8, 2019 at 11:10:43 pm

Hi Juan. Are you aware that you have Local, World or View axis modes as the three icons above your viewing window?


Return to posts index

Juan Irache
Re: Rotate object in absolute axis, not its own
on Oct 8, 2019 at 11:15:47 pm

Hi Greg,

Yes, but those modes only affect the three dimensional arrows (red, green, blue) and what happens when you drag them, don't they? My rotation is based on external data (mgJSON) through expressions.


Return to posts index


Cassius Marques
Re: Rotate object in absolute axis, not its own
on Oct 9, 2019 at 1:09:43 pm

I think what you want to do would require AE to disregard previous evaluated parameters. Which in a temporal manner, it can't. It can just evaluate the current frame and since rotation is inertly linked, you can only get what you're getting.

Cassius Marques
http://www.zapfilmes.com


Return to posts index

Juan Irache
Re: Rotate object in absolute axis, not its own
on Oct 9, 2019 at 9:54:09 pm

It's definitely possible with expressions and quaternions. Here it works well in JavaScript: https://editor.p5js.org/jeremy.behreandt/sketches/SMB8TYjkj

If there's no other way I'll try to port that when I find some spare time.


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2019 CreativeCOW.net All Rights Reserved
[TOP]