- Home /
Problem is not reproducible or outdated
Moving parent to position of child
I have a camera that is a child of an empty. The empty rotates the camera, and navigates it, however the camera controls its own zoom. An issue is that if the camera moves because of the zoom, the empty doesn't because it is the parent.
If the parent doesn't move, the issue is that the rotation of the empty gets further away, thus the pivot of the rotation of the camera changes (since the empty is what rotates).
Now moving the parent to the location of the child is easy, but then the child moves with it! :/ This is what I have so far, but it doesn't work, they carry on moving into infinity...
childOffset = transform.parent.position - transform.position;
transform.parent.position = transform.position;
transform.position = childOffset;
If anyone has any ideas, I would love to know... thanks :)
Why don't you want move the parent in the first place ins$$anonymous$$d of adjusting it afterwards? It should have the same effect.
If there's actually a reason for this, you'd just need to move your child object in the opposite direction.
Haha I should've taken this question down, yea I did exactly that, wasn't really thinking when I made the question, I suppose :D thanks anyway..!
Follow this Question
Related Questions
Problem with making child an object 2 Answers
Position of parent-Object 2 Answers
Make a simple tree 1 Answer
Camera follow ball along cylinder 1 Answer