Download

Object in a Drawer

Hi, I have made a Blueprint for a Drawer to open and close it with a Lintrace. Now i would put a Object in it. But how can i update the Position of that Object with the Position of the Drawer?

Hey. You may want to use the “AttachToActor” node. Your drawer actor will be the parent and your target will be the object inside.

I have set the “AttachToActor” node in the Drawer Blueprint as follow´s, but the Target inside don´t move…

Try setting the Location Rule to “SnapToTarget”.

I tryed every setting, the Target still don´t move.

If that’s the case, you need to start looking for the bug in other parts of your setup. How did you set up the “Target” variable in the Drawer Blueprint? Are you sure that’s even the right actor? If yes, and the right actor is attached to the drawer, check if you’re moving the whole drawer actor, not just the static mesh attached to the SceneComponent.

From your image, I can see that neither the “Target” nor the “Parent” variables are editable, and since you’re calling this attach on begin play, I get the impression that your references are probably not being set before this attach.

If you have just one variable (Target) for the actor you wish to put into the drawer, then make it editable, you can click your drawer object in the level and set the it as the “Target”.

Remove the “Parent” variable and replace it with “self”, because the blueprint you are working in is the drawer.

I have set it up as you see on the Image. I get an Error and it´s still not working. I am realy new in that, but i´m happy for your Help…

It’s quite clear that “Target” is not set, so I repeat the same question as NedimH and Unfathomable: how are you setting “Target”?

I Promote the Target to a Variable, and pick the Battery in the Level…

Ok, now this one: what is moving? Only the drawer (the static mesh component) or the actor itself? Can you show us what is after the timeline?

If you are just moving the static mesh component, then you should use “Attach to Component” and not “Attach to Actor”.

Here is an example. In this case, an actor BP (a chair) is attached to a platform and move along with it:

That´s in my Drawer Blueprint…

As explained in the previous post, use “Attach to Component” with Drawer mesh as the “Parent”.

…it Works… Thnx so much…

But i still get an Error…

A quick fix is adding a “IsValid” node between “Target” and “Target Component”.

And Thnx again… :-))