Can you make a vector timeline relative to the actor?

Hi,

I’ve created a randomly spawning floor tile, which has a bridge made up of about 9 individually moving blocks. See below:

I’ve created a vector timeline to move these blocks move from left to right along the y-axis. My problem is that when this tile spawns on a different orientation, the movement of the blocks doesn’t adjust to match. So this moving bridge will only move correctly in one orientation. Is there way to change this? Can I make the vector timeline relative to the rotation of the tile?

Cheers

I’m assuming this needs to be dynamic and that’s why you add the tiles dynamically - 7 in this very case.

Once spawned, consider attaching the tiles to the actor and then use relative location to move them about.

It depends on how you move this tiles - with setrelatilelocation or setworldlocation.

In very simple examo)e, you should use 2 relative or world locations and interpolate between them. But maybe you use AddLocalOffset, and this causes them moving in wrong direction.

Anyway, create an actor which contains tiles, and attach tiles to some scene component in it. You can rotate them in any direction, but move them in actor’s relative location.

@TheAmazingPee:

This can be done in a much more efficient way. It’s a bit of an overkill to have an actor for each piece, even though it would work, sure. A couple of questions first, though:

  1. Is there any specific functionality a tile has to possess? Essentially, is it necessary to make each tile an actor? If all you need is a moving platform, you should be able to get away with a static mesh only.

  1. Will you need a variable number of tiles or is it always the same?

The whole tile is repeatedly spawned
at intervals and can change rotation
by 90 degrees every time.


  1. Do you mean the entire bridge or are the tiles the only elements that can rotate independently? Or both - tiles spin and the bridge rotates?

  1. You’re using spawnpoints. Does it mean that the bridge can be extended? In which case - do you want to stretch the tiles to reach the other end or have more tiles to (ehm) bridge the gap.

Firstly, thanks both for replying so quickly :slight_smile:
Secondly, just to let you both know, I’m a total n00b when it comes to ue4/game development/programming.
Each block is a different blueprint, which I decided I needed to do because each one follows the same sine wave but just starts and ends further along it. The whole tile is repeatedly spawned at intervals and can change rotation by 90 degrees every time. If I show my blueprints for the blocks:

So, when I change the set location node to set relative location, they spawn off in the world somewhere. How do I attach them to the actor? I thought I had already done that with the add child actor component?

Thanks

Hi Guys,

So, Literally 5 mins after posting back to you guys, I managed to use what you said and fix the problem. Where I’ve used get actor location before running the timeline, I’ve now changed this to get relative transform and then broken the transform and used the location from that node. I’ve also changed the set actor location to set actor relative location. The combination of these two things has solved the issue. The blueprint now looks as follows:

Thank you both for your help.

Well done, then!