- Home /
Local Lerp to origin
This seems like it would be pretty simple, but I've tried about a dozen different things and can't get it to work. I have a cube that is a child of an empty world transform, so the cube's local position is 0,0,0; as is its rotation.
The cube has a rigidbody attached, so it gets bumped around and moves away from its original child position.
All I want to do is move this cube smoothly back it its local position of 0,0,0.
I can instantly move it with:
transform.localPosition = Vector3(0,0,0);
but this insta-move isn't the effect I'm looking for. I can't get lerp, slerp, or smoothdamp to move it correctly back to its child origin. Hope someone can help!
Answer by whydoidoit · Apr 30, 2013 at 09:22 PM
Not something like:
transform.localPosition = Vector3.Lerp(transform.localPosition, Vector3.zero, Time.deltaTime);
I thought this would work too, but it seems to just move it to its current position :(
Are you sure you haven't updated it's parent's position by mistake?
Your answer
Follow this Question
Related Questions
How to Lerp a position along one axis only? 2 Answers
Moving along a local axis with a slider.. 0 Answers
Turning character slowly with Slerp 1 Answer
Problem with lerp positioning 1 Answer
Changing camera position to shoot through scope on gun 1 Answer