Jump to content

Sign in to follow this  
Intenditore

Python tag - get clone's rotation

Recommended Posts

I'm curiously stuck in a rather simple problem.

I need a python tag to get the amount of clone's rotation, preferably in degrees. I wrote the code you see on the screenshot, it's not complicated (there's no iteration yet as I'm testing it). The rest is simple - a single clone in a cloner, a plane effector, which rotates it on P from 0 to 180 degrees within 10 frames

And that's what's weird: in return of "print" there must be a value from 0 to 180, 0 at F0 and 180 at F10. But it's a kind of mess, it reaches only ~68 and than declines when the clone goes over 90 degrees and falls back to 0 when it's 180. ***?

2019-07-30_03-34-20.thumb.png.75edb8610cf5b898aa7089a34072b697.png

 

Than I noticed the raw matrix.v2 (rotation) vector (second screenshot) there's the same behaviour, but the two other axis... They flip.

I wonder, why could it ever happen?

Initial clone axis are turned the right way, 0 by all the dimensions.

2019-07-30_03-59-40.thumb.png.ac693efe5fab7862a860c5cb6c52f807.png

 

What am I doing wrong and how to get done what I need?

 

P.S. For some reason I can not post in appropriate forum section, sorry

 

 

Share this post


Link to post
Share on other sites

Please attach a scene file :)


Free C4D trainings from MAXON professional on our youtube channel

 

https://www.youtube.com/c4dcafe

Share this post


Link to post
Share on other sites

I just did a test using your rig and it seems clone rotation returns

 

H  0 >> 360

P  -90 >> +90

B  0 >> 360

 

this applies to positive inputs as well as negative, a bit like modulo.

Share this post


Link to post
Share on other sites
  • Topic Author
  • 1 hour ago, Hrvoje said:

    Please attach a scene file :)

    Done!

    59 minutes ago, jed said:

    I just did a test using your rig and it seems clone rotation returns

     

    H  0 >> 360

    P  -90 >> +90

    B  0 >> 360

     

    this applies to positive inputs as well as negative, a bit like modulo.

    And this is what I can't get. Why does it work so and how to get an adequate and appropriate for me result?

    pythonGetRotation.c4d

    Share this post


    Link to post
    Share on other sites

    Here's the result of my test for H, P, B rotation done using transform. Results for P are at 55s.

     

     

    I had a similar problem recently trying to measure global rotation of a nested object - getting crazy results. It's just how it works :sad:

    Share this post


    Link to post
    Share on other sites
  • Topic Author
  • Oh God!.. What is the freaking logic behind? Is there any? :ohmy:

    I don't get how to work with it

    Share this post


    Link to post
    Share on other sites

    Depending on your scene, number of clones etc, it might be easier to not use a cloner, but iterate through individual objects using local rotation.

     

    rot = cube.GetRelRot() goes past 90 degrees ::):

    Share this post


    Link to post
    Share on other sites
  • Topic Author
  • In result it should be a huge array of clones, it will simply die if I'll do it other way. But anyway even if so, Fracture will give the same results.

    If I only could get a logic behind those strange numbers... :compHate:

    Share this post


    Link to post
    Share on other sites

    MoGraph objects use only a matrix and quaternion rotations, that’s why you get those rotation value outputs.  It’s why MoGraph can do a smooth rotation blend regardless of how many times the clones have spun


    Free C4D trainings from MAXON professional on our youtube channel

     

    https://www.youtube.com/c4dcafe

    Share this post


    Link to post
    Share on other sites
  • Topic Author
  • Quaternion are mind cracking :compHate:

    Got no Idea how to work with them here, but thanks for clarifying the cause of this behaviour.

    Share this post


    Link to post
    Share on other sites

    Join the conversation

    You can post now and register later. If you have an account, sign in now to post with your account.

    Guest
    Reply to this topic...

    ×   Pasted as rich text.   Paste as plain text instead

      Only 75 emoji are allowed.

    ×   Your link has been automatically embedded.   Display as a link instead

    ×   Your previous content has been restored.   Clear editor

    ×   You cannot paste images directly. Upload or insert images from URL.

    Sign in to follow this  

    • Recently Browsing   0 members

      No registered users viewing this page.

    Latest Topics

    Latest Comments

    ×
    ×
    • Create New...