Random Rotate Object

Hi guys,

I am trying to create a blueprint so that an object rotates one way (left), stops, and then rotates the other way (right) randomly. Quite hard to explain but if you can imagine the multicoloured part in the glass domes have to rotate randomly to juggle and move the dice.


I have this blue print at the moment but it just makes the object judder instead of actually having a small rotation one way, and then a small rotation the other way.

I’m a bit of a noob on UE4 so any help would be massively appreciated!

Hi There

I would suggest something like this, try yourself playing with the numbers. You can also use a interpolation float there to give a better looking when changing rotation.
Use as base and keep trying:

Hi!

Thank you so much for your help, There are two actions I can’t seem to find in your picture. The “Set” one on the left and also the “Rotate Yaw” on the right. I have added my blueprint as reference. What do I have to search for to get these?

Thanks again.

you need to create a float variable. so in the left you set that variable storing a value on it. Then on the right, the tick uses the new stored value to rotate the object.
also, in the left, make sure to set the timer to looping, otherwise it will happens only once. The Time there (5) means that every 5 seconds the system will update the float variable value to a new random value. And in the random float in range, set the values you want to generate there. Too high values will rotate too much, I used -3 to 3 as reference to test

Okay so I added the two float variables, and my blueprint looks like this now:

This makes the cube rotate one way, but then does not change to go the other way. The SET float has a value of 0.0 and the rotate raw has a value of 5.0. Is that correct?

yes, but the “Set Timer by Event” needs to be set to looping, this way every 5 seconds the change will occur. since the change is random, sometimes it can go to a negative value, or positive value

Hmm it still seems to only be rotating one way even when looping is ticked. Not sure what else i’m doing differently… I can see that you haven’t got a SET float variable on the left in your screen shot whereas I have both the set and rotationYaw. Maybe that’s it?

I did it! Thank you so much! It was because I made two variables and named one set! Thank you for your patience