Jump to content

Movement of a parametric object inside a Null


SharpEars

Recommended Posts

When a parametric object is placed into a Null, its matrix is in the context of it's parents matrix. How can the parent Null be moved without moving the child object.

 

That is to say, calling Null.SetMg() not only changes the position of the Null, but moves its child/children along with it. What should be used to move the location of only the Null itself, without affecting its children. This would be similar to repositioning the Null tripod with "Enable Axis" (i.e. the L icon on the left enabled, to only affect the Axis of the object) turned on.

 

Link to comment

The simplest way would be to store the global matrix of the children in a list, and after moving the parent, restore these. Then C4D will take care of all the calculations transforming global and local spaces.

 

You can also do the calculation yourself, you just need to know:

- the global matrix is a product of all local parent matrices and the own local matrix in a certain sequence.

- the inverse matrix represents the inverse transformation, and the product of the matrix and the inverse matrix is the "neutral transformation".

- matrix multiplication is not commutative; m1*m2 is not the same as m2*m1; so you have to get the sequence right.

 

Then you can take the transformation of the parent between previous and next position, and apply the inverse to the children so they are put back into place.

 

----------
Learn more about Python for C4D scripting:
https://www.patreon.com/cairyn

 

Link to comment
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • LATEST ACTIVITIES

    1. 2

      Nodes Modifier result isn't updated anymore

    2. 10

      CORE 4D Youtube channel

    3. 10

      CORE 4D Youtube channel

    4. 16

      3D world #310

    5. 53

      Looking forward to the next C4D release

×
×
  • Create New...

Copyright Core 4D © 2023 Powered by Invision Community