For most things norm is that there are no ready to use solutions, you build them from nodes or C++ functions.
The “code” depends on how you want that mesh to shake. Best way would be to create “BP_shake” blueprint with custom event “Shake IT”.
Then when you want to shake all (or some of them) shakable blueprints, you do “get all actors of class” then “for each array element” on resulting array.
Then you call “shake it” for every actor in loop. That is how you shake them all.
Because shaking is not instant action, you need those events and blueprints. And this is how you shake them:
When you call “shake it” event, your shakable actor which was called should get “current game seconds” value, add how long it wants to shake, and remember result.
Then in that actor in “event tick” event you should randomly pick vector in some range (will describe below some ways) and apply that vector to “relative location” for mesh component that is visible mesh in “shakable blueprint”.
To check if it is still shaking or not compare “current game seconds” with value you stored. When current is greater set relative location of mesh component to 0,0,0.
This also needs some additional check so that resetting to 0,0,0 does not happen every tick, but just once when actor should stop shaking. So some additional boolean variable and check are needed.
Now how to get nice random values:
You can make [0,0,1] vector, random rotatior, and random float in range.
Then rotate that 0,0,1 vector by random, rotator, and multiply by that float variable.
Result should be some location on sphere surface. This is much nicer than just random location.
It also has additional benefit: you can rotate your mesh by same random rotator if you want it always face outside direction.
is there anyway that you could share that blueprint with me please? Because I am trying to make sens of it but I am lost very quickly. Thank you very much
As I said I am using event tick, but this could be a function or a custom event.
Get 3 random float in range (I did use integers, but I would change them to floats) , I used -5 to +5. Then I add these to the variables you set off begin event play (New var/ New var0 / New var1).
Make a rot of that and then set the world rotation of the mesh.
I put a .1 delay in it so it does not go completely nuts.
thank you for your .
I am stuck right at the beginning because I can’t find the GertWorldLocation like yours, with 3 entires, so I can connect them to the 3 variables. The rest seems ok, but this one I can’t get it.
Actually it is already shaking like that (so I don’t know if I need to change anything).
But it move to 0.0.0 in the world and does not stay where I placed it.
What exactly are the pins between the “random integer in range” and the “make rot”… I can’t find them because I don’t know the name. Any help please? I appreciate it ahead of
It’s definitely on my to do list… I’ve managed to make some awesome things without the need to have a profound knowledge, but I intend on learning more … I appreciate the help