Download

Offsetting rotating obstacles

Hey all

I’ve got some rotating beams that rotate at their base and kill if touched.

What I’d like to do is ‘offset’ the start of the rotations so they all rotate at exactly the same speed but the rotations are not aligned … so they rotate as if a wave was flowing down them - so if you see the attached image;

1 starts at 0.0 seconds
2 starts at 0.1 seconds
3 starts at 0.2 seconds
and so on …

Currently the rotation is handled with event tick, I tried a delay, or timers … I couldn’t really get them to work and seemed like clunky solutions

What would people recommend as the best solution for my request?

Thanks!

N

This is my best attempt so far but doesn’t work;

‘Set actor tick enabled’ is set to false by default

I then on ‘Event begin play’ set the ‘start spin’ Boolean to true - with a delay added in that I can change the value of for each obstacle so I can achieve the effect I’m after

This does change the Boolean in the ‘Rotate’ function but by that point the Event tick is killed and doesn’t seem to be doing anything so it doesn’t work …

humm

Why do they need to all start vertically?
if you just set them up at the rotation you want initially individually, then that’s all you have to do.

And TICK is the clunky solution.
Using a rotating component or manually rotating with custom timer is the Better solution.

And if Actor Tick Enabled is False, Why would you expect the actor to use the Tick function? You’d have to re-enable the tick.
Again. Tick is the completely WRONG way to do this anyway.
You just created 10 actors with tick. that suck up resources for no real reason. At the very least they could all be grouped up to run in the same tick function by a TickManager or something similar.

Best option that’s consistently perfromrant is you create an actor that gets ALL ACTORS OF CLASS “beam”, And you use that actor’s Tick event to cause the other beams to rotate and operate.
At least this way you have 1 tick function running for all of them.
You are literally just updating a rotation anyway. So each element takes it’s previous position and adds to it. pretty simple.
And the manager can automatically offset the start/point with a random node.

Here is how I would do it: ThirdPersonPractice Unreal Editor 2021 09 19 19 39 37 - YouTube

First loop on beginPlay creates the beams, distributes them and adds them to an array for later.

After all beams are created, it runs into this clossed circuit triggering each interface with a delay between each. You will need to create your own a for each loop with delay for this.

this is how the beam blueprint is set up:

This only allows a single wave at a time, starts over after the last beam in the array is triggered. You’ll need to be a bit more creative with the loops to add more waves.

No tick events needed for this.

Hope it helps.

Still performance heavy considering it’s a different timeline for each beam.
Because a unit circle is always 2PI radians this is completely unnecessary overhead…

If you have the time to give some feedback… this is with one BP with tick controlling all beams, having them stop after one spin (just because). This video shows how the variables can make it flexible.

This is beam BP.

This is the BP that controls all rotation:

  1. Update every beam that can spin.

  2. “delay” that skips loops for a given time to slow or speed up how fast the next beam starts to spin:

  3. Start spin of beam in order:

Everything:

Looks much better.

If the interface isn’t a must I would cut that too.
No point wasting resources on it.
But this is already much better than each beam having its own tick call.

1 Like

The only thing that I saw that was accurate was the pic with the timeline and Lerp 300 variable. You dont ever have to use event tick. If all beams are not setup in the same BP, but are all on the same level I would add function on the Level BP for all of the beams, using the timeline method I mentioned. The only difference is the tick, instead, and if lol, you want the beams to react to something I would create a box collision on the level that enabled a “Set timer by function” and use that to make the area with the beams ‘Active’ at that point the tick from the timer you can use to do whatever, and then cut the tick off with a pause or stop all timer by whatever when the actor leaves the collision box. This way tick is only when you want, and you could control the timing of the tick. “Set timer by function” or anything else is always better than tick. IE, I have fans that spin on a timeline in the same exact way as mentioned, but that timeline only works when I walk into the area where I can actually see them. Using a multi gate and creating a loop with custom events and delays on entering a collision works better than tick as well. Cheers, this is all just my honest opinion nothing factual.

Sorry, one more Idea in case you want these beams in multiple places and multiple levels. You could create a master BP, with one call function that cast to all the BPS at one time through a Game instance. One timer still controlling everything. And that Master BP could be where your box collision is, and your beams could be anywhere. Anywhere you put the Master BP, it calls to everything. Just in case you havent already thought of these things.