- Home /
How to smoothen movement of a child object?
I have a character that has a camera as its child. The camera is positioned at the character's eyes. The character, thanks to its somewhat awkward animation, doesn't move its head smoothly, so the camera jitters horribly. Is there a way to smoothen the movement of a child object that doesn't move smoothly with its parent?
Answer by bzgeb · Sep 27, 2012 at 09:36 PM
You can use Vector3.SmoothDamp to smoothen the movement: http://docs.unity3d.com/Documentation/ScriptReference/Vector3.SmoothDamp.html
You'll probably want to remove the camera as a child object, and instead have the camera interpolate between it's position and the transform of the character's eyes on each frame. This may not produce the desired results though, but it's hard for me to guess.
Another option would be to position the camera at the character's position + an offset, instead of placing it directly at the eyes. That way it won't follow the animation as it changes, just the player's position.
Thanks a lot, this helped me solve the problem. I want the camera to move with the head's animation so I used your first suggestion.
Your answer
Follow this Question
Related Questions
Make a simple tree 1 Answer
Child affecting parent rigidbody? 1 Answer
How to change position of child component without affecting the position of the parent 1 Answer
[SOLVED]Why is this scripts output so choppy/glitchy? 2 Answers
How can I prevent position of a child transform to be hooked to the parent in a prefab? 1 Answer