Jump to content
Sign in to follow this  
Ragul

Hierarchy issue in Python

Recommended Posts

Posted (edited)

Hi. I just want to set parent of each bone.

But my bone always jump to position wich set in local coordinate. How to fix it?

image.thumb.png.545c95e09805f921e197226d579b7b12.png

image.thumb.png.bf80700cb8aa91f9d04dc2923bcd92fc.png

 

 

test.c4d test.py

 

Edited by Cerbera
Fixed spelling in keywords

Share this post


Link to post

You need to backup the original position in world space and set this after insertion. Easiest done by storing the global matrix (GetMg() and then later SetMg()).

Explanation:

An object only knows about its relative position (relative to the parenting object, that is). Its global position in world space is not stored anywhere, but is the result of the "accumulated" positions of all parents in the hierarchy and the object's relative position (same for scale and rotation of course).

By just changing the object's position in  the hierarchy, it will keep its relative position, which in combination with the new parent leads to a new position in world space.

 

Cheers

 

Share this post


Link to post
  • Topic Author
  • Author of the topic Posted

    Yes. It's work. Thanks! image.png.5878fc79c950b46951e9d7e93e0cc8d1.png

    Share this post


    Link to post

    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.

    ×
    ×
    • Create New...

    FORUMS INFO:

    Dear members, we are aware of few more bugs that are still present withing the theme.We just wanted to let you know that we are working to fix them as soon as possible.
     

    NEW MEMBERS:

    Please be aware that we are manually approving all new registrations, due to spam prevention. Please be patient in case you cannot login right away, we will approve you within 12h or less if we decide you are not potential spammer. 

     

    Thanks for understanding! :cowboypistol: