MAXON CINEMA 4D: Cinema 4D Forum Adobe After Effects Forum

# Flattening 3D rotation to 2D planar rotation via Xpresso.

VIEW ALL
 Flattening 3D rotation to 2D planar rotation via Xpresso. on Dec 1, 2014 at 2:30:29 am

Hey all, Im having a hard time working out some rotation math in Xpresso (I'm also having a hard time explaining what I'm after, so please bare with me).

I want to take an object (which is rotated arbitrarily in 3d space) and then "look at it" through an orthogonal plane to get a single 2D rotation value. Effectively flattening 3D space to 2D planar space.

Here's a digram that attempts to explain what I'm going for. Any help would be greatly appreciated! Also, apologies if this makes little sense, I'm struggling to articulate what Im trying to do.

 Re: Flattening 3D rotation to 2D planar rotation via Xpresso.on Dec 1, 2014 at 4:50:38 am

I'm sure there's a mathy answer to your question, but since I'm not much for math I jiggered up a little rig with constraints that will do the job. What I did was use Xpresso to constrain a null (null.1) to the end of the arrow. Then I used a position constraint to constrain just the x and z position of another null (End) to null.1's position. Then I created a third null (Start) at the same Y height as End and used an aim constraint to point Start at End. The H rotation of Start provides the 2D rotation of the arrow.

Hopefully it's easier to understand from looking at the file: 8250_3dto2drotation.c4d.zip

 Re: Flattening 3D rotation to 2D planar rotation via Xpresso.on Dec 1, 2014 at 5:45:57 am

Thanks for having a crack at this for me :)

I see where you are heading with this- and if my end goal was simpler, I think using some clever constraints could definitely work. The thing is, I will be using this component (with many different values) on many different objects within my workflow. So I need something super lean and reusable… Sadly I think I will need to find a mathy solution (which is a big shame, because math = fail for me.)

I've been looking into the math all day and am just overwhelmed by everything I don't know… even the basic trig is confusing me (dammit, being bad at things sucks)…But I have this feeling what I'm trying to do is very basic… But I just keep getting lost in equations and terminology I don't understand.

 Re: Flattening 3D rotation to 2D planar rotation via Xpresso.on Dec 2, 2014 at 12:48:15 amLast Edited By Nathan Clark on Dec 2, 2014 at 1:12:16 am

Okay, so after a good sleep I hope I'm smarter today and wont waste another day on this. Sorry to double post, but I think I might be able to make things clearer now!

Adam's work made me realise that (if I simplified things a little) all I need is the Up Vector. Attached is a scene file that has a null constrained to a sphere via the Up-Vector Constraint. The null behaves exactly how I need it to…

Now I just need a way to do this in Xpresso, calculating the Up-Vector from the null to the Sphere (rather than using a constraint). I want to say:

"Oh hey Xpresso, here is my source object and here is my target object. Can you please work out the Up Vector for me?"

Does this make things clearer? Easier to solve? please? :)

8253_3dto2dretargeting01upvector.c4d.zip

 Re: Flattening 3D rotation to 2D planar rotation via Xpresso.on Dec 2, 2014 at 4:26:04 am

Hi again, me again, rudely triple posting.

Just wanted to let you know I worked out a pretty clean solution, that I am going to use, via a single reference null per calculation. Embarrassingly simple actually.

Just in case anyone wants to have a look, and maybe have a little giggle at my expense :P here is the file:

8255_3dto2dretargeting022drotationviaconstrainedrefchild.c4d.zip

Mark as Solved!