How to rotate parent node without affecting child node?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Qws
:warning: Old Version Published before Godot 3 was released.

I’ve worked very hard on a 2d Skeleton which required an hierarchy.

But it seems I can’t transform a character part without affecting its child?

So, does this mean I have to strip down the hierarchy to adjust the parent node without affecting child node?

:bust_in_silhouette: Reply From: avencherus

Children receive the parent transformations by design. If you don’t desire that, you’ll want to keep the nodes adjacent, while using a root node that only acts as a general container.

Is it possible to make a skeleton in that way?

Qws | 2016-12-11 19:28

You won’t be able to use bones or IK chains, since they point from pivot to pivot without parenting.

But isn’t this like a question of how to make something hard and soft at the same time?

avencherus | 2016-12-11 19:37

I don’t really see that’s similar… I admit I’m a beginner, but how is adjusting parent node not possible in a skeleton. Imagine if I want my skeleton to rotate its head, how can I rotate it without rotating his whole body?

Qws | 2016-12-11 23:51

In that layout the parent would be some core body piece. The arms, legs, and head would be children of the body. So you wouldn’t parent your arms to your head.

For an example I would recommend this video: https://www.youtube.com/watch?v=Mz4wrV0FsDo&t=8s

avencherus | 2016-12-11 23:57

Thank you by the way… (I know it’s 3 years later xd)

Qws | 2019-12-20 12:31

:bust_in_silhouette: Reply From: SasQ

Make a hierarchy like this:

Main container
   Independent rotation
   Another piece

Now, if you want to rotate just the Independent rotation node, you can freely rotate it without affecting the rest of the skeleton. And if you want to rotate it along with Another piece by the same amount, rotate the Main container instead, and both its subnodes will follow.

:bust_in_silhouette: Reply From: qaptoR

Another way to design this, if it’s something you want as a baseline (that a child does not follow the parent), just structure the relationship like this
Parent:Spatial > Container_child:Node > desired_grandChild:spatial
what happens is that because standard Nodes don’t have transform data, they don’t pass on the transform information of the parent to the grandchild, meaning that you now have a way to create independent rotation of a parent from a grandchild

However, this also means that if for any reason you do need to rotate a grand_child with the parent, it will have to be done through code somehow… (maybe by using re-parenting?)

I learned of this because if you have a viewport as part of a scene, then the camera childed to the viewport will not move along with the scene root, because viewports do not have transform data.