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?
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.
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:
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.
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.
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?
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
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?
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: