How do I move an actor within an actor based on the parents orientation?

Hi everyone!

So basically, what I’m trying to do is create a hatch door actor that slides open and closed when triggered that can simply be dropped into the world and works. I’ve got it to slide open and close along its X axis when triggered via a timeline, the problem is it seems to move the hatch within the actor based on world location, which means if the hatch actor is rotated in the world, instead of sliding to the side, it’ll slide skew and out of the frame because its using the X axis of the world, not the parent actor or itself.

Sorry, I know its probably a noob question but I’ve tried all kinds of things and I’m stumped, thank you in advance!
This is what I have so far (within the hatch actor). There’s a left piece and a right piece that side apart and together when open and closed. I have it all hooked up to a temporary trigger box for testing and it works, just not when rotated in the world.

Hi!

I’m having this exact same problem with some moving platforms I’ve created. I have a floor blueprint that randomly spawns with a bridge that moves along the Y-axis. These platforms can spawn at 0, 45, 90, 180 degree orientations but obviously only move correctly when they spawn at 0 degrees. I realised this was because the timeline was relative to the world axis, but I can’t find away to change this without creating a different timeline for each orientation and calling in the correct timeline based on the objects orientation on spawn. Is this the only way?
Did you manage to find an answer? If so, could you pass it on please? I’d be super grateful :slight_smile:

Cheers

Pete

its a pretty easy thing to solve, all you need to do is be working local / relative space for the actor. the basic idea is that instead of setting the actor location you want to be setting the location of the components within the actor. the components location is relative to the origin of the actor, so you can set a a components location to say 100uu on the X axis and it will in relation to the actors location instead of potentially ending up across the map. that may not have been explained well but the picture below shows an example.

in the example below the two meshes would be your hatch doors and we are trying to move them apart so they are open. i have the pivot/origin of each mesh at 0 0 0. then i just use a timeline to control the time it takes them to move and the lerp to control the locations they move to and from. the timeline used here is a 0-1 value over 3 seconds. the only other thing to note is the multiplication node which acts to reverse the direction for one hatch since they need to move apart.

Edit: also note that for this to work you do not want the moving object to be the root of the actor.

Thank you, much appreciated! :slight_smile: