Drawer interact issue

To put it simply, i want to make a drawer for my game, simple as that. Though the method i usually use for things like doors is animating the movement, so i try it on my drawer but it didnt work, the position kept teleporting to where i originally animated it. When i tried the animating method on the door, it worked fine. I was questioning this until i realized, for the door im only manipulating the rotation property of the transform, so it works for different doors in the scene. but for the drawer, i am manipulating the position of the drawer itself, so wherever i originally animated the drawer, it teleports there when I interact with it. Is there a way to possibly fix this or an alternate way to do drawers?

Well, first of all you probably shouldn't have animated properties that you don't want to animate. So those curves should probably be removed from the animation. They also add unnecessary overhead, even when the position it animates is always the same.

If you can't get rid of the position curves, the usual solution is to wrap the object in a new empty gameobject. The animation always animates the local position. So it's fine when it sets the local position of your actual drawer within the newly created empty gameobject. So you can move the outer gameobject where ever you want and the local position of the child can be kept at it's original position.

1 Like