I’m trying to create a blueprint that allows me to open drawers in a desk, depending on which drawer is being hovered over by the mouse. So far the hover feature works, but I’m having trouble with setting the new location and blending it in with an animation using a timeline. I need to be able to add a value onto the existing Y-Axis location, as well as using the animation from the timeline and I have no idea on how to do this. If anyone could give me some pointers on how to resolve this, I’d extremely appreciate it.
I’ve made an adjustment to my blueprint and now I can see that it is moving the drawer, but not in the correct way I want it to. Instead of the drawer moving outwards normally, it gets mapped to the bottom of the desk and displaced to the side as seen below.
I know why this is happening and it’s due to location not being setup to take in the drawers coordinates. But as well as this, the drawer doesn’t animate to the given location, it just snaps and for that, I have no idea why it’s not working.
So, actor components work on a hierarchy system. If you place a static mesh component at 0, 0, 0, it will place the locator/transform/pivot (whatever you want to call it) of that static mesh at 0, 0, 0 within that actor which means the component is located in world space at the same location of the actor. A component that has a transform, not all do, can have at least two locations, a world location, and its location relative to the actor.
Using relative location allows you to change the position of a component relative to its actor. You need to know where you want your component to be relative to your actor. You are setting y to ?, but are setting x and z to 0 which means it will be exactly where it is shown.
Ok, lets do this the easy/hard way.
In your timeline create a vector track, that is the one with a V. You will have R, G, & B lines to set time and values on, they may be on top of each other because they are all set to 0. Go into your viewport and record the values x, y, & z values for where you want the drawer to be while closed. Go into your timeline and right click on one of the lines and add a key. For x, y, and z set the key time to 0 and the value to whatever the closed values were. Go back to the viewport and record the open values. Back in your timeline at the top click on the length and set it to .5. Right click on any line that is going to change. x or y depending on which way your desk is facing. Set the time value to point five and the position value to whatever you recorded. Now, put the output directly into new location in the set relative location.
Remove that make vector…and it should work.
That now makes the drawer work correctly. Since I’ve only been using Unreal for a few weeks, I had the track on the timeline set as float and not vector, so thanks for clearing that up. However, it still makes the drawer pop out instantly with no smooth transformation. I tried applying what I did for a locker door here, but doesn’t seem like it wants to work. Without the starting point inserted, the drawer moves out instantly, but with the starter point included, the drawer doesn’t want to move at all.