How does translation of children objects work? [Solved]

If I translate an object along a specific axis but it’s parent has rotation the translation vector is altered.
How can I translate a children object across it’s local axis regardless of the rotation of it’s parent?
I’m trying to implement a third person camera and I want to make the camera get closer or further from it’s target, to which it’s parented.
Here’s a simple scene i made to show the problem:
parentRotation.blend (706.0 KB)
Use left and up to apply rotation to the parent cube, use space to translate the children object across it’s local Y.

Thanks for your attention.

As far as I am aware, “parenting” implies a spatial relationship between the objects in question: specifically, all transforms applied to the parent will be applied to the child, starting at the root of the parenting hierarchy, before any transforms specific to the child occur.

Thus, I suspect that the camera can’t be “parented to” the object that it is intended to track. The camera will need to be provided with some other way (e.g. a custom attribute) to know which object it is supposed to be looking for . . .

Thanks for your answer.
Thing is the implementation i’m going for doesn’t use the look at node, it’s not parented to identify it’s target, it’s parented so that it moves and rotates with it’s target.
I might have to find another way of doing this, perhaps I should rely on transform matrixes instead of parenting.
Anyway, if there’s some way of doing what i was asking for it would be interesting.

Every objects transformation is actually relative to its parent. If you uncheck the “On Local Axis” checkbox in your example, it will work how you are expecting it ( if I understand what you need correctly ).

image

The reason is, when you take an object and make it a child of another object, the parent object becomes the new reference point that defines the child’s “world” so to speak. If you move the child along the y axis, it will actually move it along the y axis aligned to its parent. If you rotate the parent object, and try to move the child along the y axis again, it will have the same movement relative to the new rotation of the parent because the child’s “world space” is aligned to the parent.

1 Like

How weird, I was almost sure i had tried that. It works, thanks, though I think matrices will work better for what i’m doing now after all. it’s good to know anyway.

Btw, I saw you had a post asking how to get the exact location in which a physics ray hits a rigid body instead of it’s origin, did you get that to work? I think i’ll need that for the camera (to avoid obstacles), and seems like it would be pretty useful in general.

There are hit point and hit normal node sockets on the Cast Physics Ray node:

image

Those will be in the world space.

1 Like

Ah, yes. An error while wiring led me to believe the Hit output gave the origin of the hit object. It’s working as intended.
Thanks for your patience.

1 Like