how to parent bones without changing there global pos or rotation

Moho allows users to write new tools and plugins. Discuss scripting ideas and problems here.

Moderators: Víctor Paredes, Belgarath, slowtiger

Post Reply
Joh_Jos
Posts: 2
Joined: Fri Nov 18, 2022 11:09 pm

how to parent bones without changing there global pos or rotation

Post by Joh_Jos »

Hi
I am new to scripting so I think this is a simple question but I can't get it!
I am trying to parent bones without changing there positions
first idea
I was thinking to store the pos data for the child and the parent bones then substract them to know the difference, and after parenting add the difference value
then i will have to deal with the rotation
I don't feel this should be so complicated

second idea
after some research I found the matrix but I can't understand how does it work?
is it like saving data before parent on LM.Vector2:new_local() and after parenting on another LM.Vector2:new_local()
when to create LM.Vector2:new_local() and when to create LM.Matrix:new_local() ? :roll:

Thank you guys
User avatar
synthsin75
Posts: 10007
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: how to parent bones without changing there global pos or rotation

Post by synthsin75 »

Off hand, I'd say look at the reparent bone tool. It should be a good example.
Joh_Jos
Posts: 2
Joined: Fri Nov 18, 2022 11:09 pm

Re: how to parent bones without changing there global pos or rotation

Post by Joh_Jos »

Thank you this simple answer helped a lot :D
I kept looking for scripts using similar code forgetting the built-in scripts :oops:
Post Reply