how to do full child-parent transformation, without parenting?


i’ve searched the forums and answers for this, and even though i found some close matters i couldn’t find it, and it must all be down to math/geometry.
i don’t want to parent a gameobject to another one, because i want to avoid compound colliders creation (how i wish there was an option to turn them off!) so i must do the rotation and position of the child manually from its parent.

function LateUpdate(){
	transform.position = parentPiece.transform.position + localPosition;
	transform.rotation = parentPiece.transform.rotation * localRotation;

but i know i’m missing a bit in the position. because when i rotate the “parent” object the child does not follow in the place it should. it changes the position/rotation locally and it’s not really behaving like a child.

so what do i have to add at the position part to make it look right? any equations for this?
thank you!

Well what you’re doing is definately wrong, but I don’t immediately know The correct calculations.

But you could just use a workaround though:
Create a new empty gameobject with identical transform to the wannabe child, make this the child instead.
Then in a Late Update you just set the wannabee child’s transformation equal to the new emptychild.
Ofcourse, that’s assuming you don’t want to change the child’s local position/rotation.

or just use Transform.TransformPoint()

transform.position = parentPiece.transform.TransformPoint(localPosition);

Hey, I actually found a cool gut repo few hours ago : GitHub - pointcache/Unity-3d-Constraints: Constraint components used for rigging

Why not use default constraints? Cause they update somewhere after animator IK and late update in a loop called “PreLateUpdate”, which is a problem for Animator IK. It forces you to use the “Animation Rigging”.

Not anymore, have fun!