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

Applying inverse of global position and rotation to a null group

COW Forums : Maxon Cinema 4D

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
Rob LeitzellApplying inverse of global position and rotation to a null group
by on Jun 4, 2014 at 4:49:12 pm

Hello--

I'm working through some projects that require me to have the ability to selectively lock the global position and rotation of a set of objects in my scene, by applying the inverse position and rotation to a null object that is parented to a duplicate group.

(In short, I'm modeling scenes in a virtual space that need to turn into real-world camera moves around miniatures. I'm trying to take scenes of multiple spaceships moving and rotating with moving cameras, and selectively lock transforms and rotations, so that, say, spaceship_1 is locked off entirely, but the relative positions of spaceship_1 and camera_1 remain the same, requiring camera_1 (and any other related scene lights, objects, and such) to perform the sum of their moves and the inverse of the spaceship_1 move)

I have built an xpresso tree to lock out the transform without too much trouble, but am having a hard time getting the rotation to lock. Basically, I can do one OR the other, but am having a hard time doing both. I created a duplicated of all the objects in the scene, took the global position of the object I want to transform in the original scene, ran it through 3 Math -> Divide nodes by -1, and applied that to the global position of Is there a feature somewhere that would do this more easily for me, or someone with a touch more xpresso knowledge that could lend a hand? Would be much appreciated.

r


Return to posts index

Darby EdelenRe: Applying inverse of global position and rotation to a null group
by on Jun 5, 2014 at 4:02:18 am

You can do this by applying matrix transformations.

You'll need a duplicate of the 'Source' object and a camera to apply this adjustment to. Remove all animation from the duplicate object and make the new camera a child of the duplicate. Use an xpresso tag to perform the following operations:

1) Invert the Source Object's global matrix (use an 'Invert' node in 'Matrix' mode).
2) Multiply the inverted Source Object's global matrix by the Source Camera's global matrix (use the 'Math' node in 'Matrix' and 'Multiply' modes).
3) Connect the output from the matrix multiplication into the Adjusted Camera's local matrix.

The order of the matrix multiplication is important, the Source Object needs to go into the first (top) input and the Source Camera needs to go into the second (bottom) input. It's also important that the new "Adjusted Camera" is a child of the stationary duplicate object since we're applying the motion to that camera's local matrix.

Here's a simple example file:

7580_matrixtransformations.c4d.zip

Darby Edelen


Return to posts index

Rob LeitzellRe: Applying inverse of global position and rotation to a null group
by on Jun 5, 2014 at 7:54:18 pm

Wow! Thanks so much, that works brilliantly well.
What if I wanted to lock an object, and have a camera and other objects in the scene also follow an inverted path? I've been able to do it if I make multiple copies of the xpresso tag, modifying the references for each, and making multiple duplicates of the scene, which isn't a nightmare, but wondered if there was a simpler way?

Again, thanks so much!

Rob


Return to posts index


Darby EdelenRe: Applying inverse of global position and rotation to a null group
by on Jun 6, 2014 at 1:05:37 am

There might be a way to make something work but I'm confused about the goal, should there be one camera for each object?

Object xpresso nodes can be made relative and there are nodes that can iterate through hierarchies or lists, so it seems feasible.

Darby Edelen


Return to posts index

Mike UdinRe: Applying inverse of global position and rotation to a null group
by on Sep 12, 2014 at 8:08:42 am

Darby, thanks so much for this example scene file, because this is almost exactly what I need!
You have turned out well convert camera animation and object animation only one camera. Maybe you can at the same example to show how to do so that the camera does not move, but the animation object repetitive motion of Source_Object and Source_Camera. To view from Sourse_Camera and Adjusted_Camera will still the same. Thanks!


Return to posts index

anil kumarRe: Applying inverse of global position and rotation to a null group
by on Jul 28, 2015 at 7:58:41 am

hi Darby Edelen

i see your nice post and download your c4d but i am maya user
if you have same solution for maya please give some info or guide me please

i really need this way

my problem is - i have a maya scene with camera animation with a car animation in scene i want all the animation as it is in camera view but no animation in my camera.

so please if have any idea to solve this i really thanks for...

Regards


Return to posts index


John LockeRe: Applying inverse of global position and rotation to a null group
by on Sep 10, 2015 at 7:58:56 pm

Hey Darby, I can't tell you how appreciative I am for your contribution to the Cow and specifically for this thread! Thank you thank you thanks oi oi! Your brief explanation/solution of inverting matrixes to track objects position's relative to one another has just helped me solve an issue that has plagued me for longer than I care to share. Working with Global & Local Matrixes in Xpresso is not, IMHO, straightforward or intuitive, but your simple example project file finally kicked a light on.

A thousand thank yous!
_j

Oh Tunkashila, hoh.


Return to posts index

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