Get position relative to parent further up the chain

Suppose I have a chain of meshes in a parent/child hierarchy…

A (no parent)
B (parent is A)
C (parent is B)

How can I get C’s position, in A’s space (relative to A, taking all transforms into account)? I thought it would be as simple as c.absolutePosition * inverse(b.worldMatrix), but this doesn’t seem to be the case. Am I thinking about this incorrectly?

So far I know … the positions of parent/child relations are relativly to each other.

a.x = offsetA (from zero)
b.x = offsetB.x
c.x = offsetC.x

Therefore the formula should be for x position:

c.x = a.x + offsetB.x + offsetC.x

This would be good if rotation isn’t involved, but unfortunately it is :frowning:

I don’t think that Euler angles are additive like that when composing rotations :thinking:

I found the problem, my initial solution worked, but I was being thrown by the floating point errors showing scientific notation like -6.474743473743e-something, basically 0

Sorry, my fault. Didnt sleeped well these days…

But I’m happy that you found a way.

1 Like

Hey I appreciate the help! You got me thinking anyway.

I too have been struggling with sleep :frowning_face:

1 Like