What is the best way to simulate a shutter in unreal engine?

Hi there,

I am implementing a shutter like this one in my scene:

What would be the best way to simulate this object? It needs to go up and down, each slat needs to tilt seperately and it would be nice if you could stop it at any position and rotate the slats. So this means you have to simulate every slat(in this case i got 37) and that is pretty much to programm when you do it in a blueprint with timelines for every slat.

I think thats the wrong approach. A GUI, where you can change the position and angle would most likely be the best way to steer each shutter(because i have more than one) in the scene.
Could you guys help me to get a solution of how to implement the movement of this shutter in an efficient way?

Thank you very much.

A blueprint is the way, for sure. Possibly with a skeletal mesh, depending on your skills and preferences, but you can do the whole thing with two timelines, one for up and down, and the other for the angle of the slats.

If you already have the slats as meshes in the blueprint, you can put then in an array, then it’s easy to run the timeline over the array, just like you would a single slat.

Another great way is to add the slats as static mesh components at construct time. That way, you can choose the size and number of slats etc.

shutter

It’s not quite there, because the upper slat should not move, but it’s along the right lines… :slight_smile:


and later...

He shoots, he scores

shutter2

2 Likes

For a game to get the most performance out of scene you’d probably want to use vertex animation for something like this, Vertex Animation Plug-In For UE5 Tutorial (there’s even a shutter example, but a different effect)

But blueprints is likely a lot easier to setup and control.

1 Like

Thank you very much for your response.

This seems like a huge possibility to implement it in my scene.
I am quite the nooby so I have still a few questions :smile:

How did you define the “shutter number” in you graph and how can you control it in the details panel?

The scale of my slats are already in a defined measurement, so I don’t have to change it I think.

Most important question:
The movement of my shutter is a bit different than in your video. It is like this(cannot upload video yet, so its a wetransfer link, sorry :smile: ):

Is it also possible to implement this movement with your approach?
Thank you again for your help.

I did everything in the construction script, which means the variables are just exposed to edit

When you update variables the construction script runs, hence the change. But it’s also easy to convert things from construction to the event graph, ie runtime.

shutter3

Your movement is more complex, because only the bottom part moves and sort of catches the slats as it lifts. Also the way they turn down when the blind comes down again.

Yes, it’s also possible to do this sort of thing in code, just more of a fiddle.

1 Like

I’d rather go with shader code on this.

Really it depends on application:
a game or VR? → Shared Code.

Archviz / Stills / Renders? → instances or meshes are perfectly fine. Since performance is not a concern.

What would the shader do?
Well, if you make a single mesh, with 2tris per (no idea what you call it) blade, you can have the shader take care of rotating and positioning the blade.

Much like the code demonstrated above does.
In fact, you’d probably use the same 2 variables, one for height placement, and one for rotation.

The benefit to performance is that it’s all going to happen on the GPU side, and it can support a near infinite amount of shutters compared to having each shutter blade be “it’s own thing”.

The other benefit is that you can create shutter assets outside the engine, apply the material to it, and have it work right, regardless of how many shutter blades you add…

And the added benefit is that you can cause tangles and crooked blinds relatively easy by defining what vertex you want the shader to affect via Vertex Paint.

The downside is the day and a half it takes you to code something like this up :stuck_out_tongue:

1 Like

Hello again @ClockworkOcean,

Thank you for your help so far. I learned a lot.
I tried to implement your simulation in my scene. That worked for me, but I don’t have the Know-how to implement my movement in my scene.
Could you maybe help me one more time to help me with my problem. I would appreciate it alot.

Thank you.

1 Like

In a cut scene you can directly keyframe variable changes, can you not?

It is possible with a bit of math, I think.

The more usual ways would be skeletal mesh, or as @MostHost_LA is saying ( I think ) using the sequencer.

I must say though, the sequencer is a real pain for this kind of thing, because it’s not general at all. Skeletal would be the way.

I’m just having a think now, might come back soon with something snazzy :slight_smile:

1 Like

Ok, this is it :smiley:

shuttery

3 Likes

Wow, thank you, thats looks great.
That’s exactly what I was thinking about.

Did you do that with a skeletal mesh or did you just import a mesh and worked with that?


I just copied your code and tried it with a “Make Array” and a “For each loop” but it does not work. The arrows are just parents for the meshes(to set the right pivot point). Is it even possible to do this that way?
I’m sorry I am very bad at this haha.

1 Like

If you have an array of components, you can adjust the code like this

It’s easier to make the array with

( using the correct class ).

Also, the way I’ve coded it, the default engine cube pivot point has this orientation

So that’s why we’re rotating along X.

If the slats do something really weird, you can just change the axis you’re rotating on here

1 Like

Indeed, though not sure sequencer is what its called today? They keep changing the name for the system ever other year or so…

The idea is your sequence (or whatver is called) stores the value of the variable at every frame, and is able to go back to precisely the same value, or wind and unwind as you need during the sequence.

Similar if not identical to a timeline essentially.

2 Likes

I gave up fiddling with the sequencer when it turned out that all the parameters are just bound to the actors you’re currently working with, and you have to do it all again for another, even if you just move the same actor!

Epic had apparently had a go at position independent sequence at one point, but when I tried it, it didn’t work. And then I got better at blueprints… :slight_smile:

2 Likes