How do I add randomizer to rotating movement component in Blueprints

Hello, I am working on making a space game and I have asteroids that spawn in and have a random rotation. That all works, however after they are spawned in at a random rotation I then want them to being rotating on a random axis so it looks like natural asteroids spinning in space. So far I have it so they spawn in at a random rotation and they spin however I can’t figure out how to make the spin random as well it is always spinning on the same axis at the same speed etc… Here is a screenshot of what my blueprint looks like so far, anyone know how I can do this properly so they spin randomly?

Hey @Lopti! Welcome to the forums!

So you can go ahead and just add the rotating movement component as part of the generation of the actor, like so:

image

Then you can click it and look in the details window for all of its variables.

By default it is set to 180 degrees. If you drag that in (or right click → Get Rotating Movement component) you can then drag off of that and use “Set ____” with any variable it has in the blank to set the rotation speed you would like. :slight_smile:

Thanks, yeah I knew that part but what I am needing it to do is every time the object spawns in I want it to auto-randomize the rotation axis and speed. What you suggested would work fine if I just wanted to set the rotation and speed of a single object and place it into my world. However my objects are spawning into the world randomly at random rotations and I now need them once they are in the world to spin on a random axis and at a random speed for which I can set the min and max. Just not sure how to do that last part in blueprints.

You’re almost there!

You know how to get a random float, now you just have to do what you did above for the Rotating Movement component’s rotation rate.

image

image

Let us know if you have any trouble!

Awesome, I will try this once I get back to my computer and let you know how it went either way, thanks.

1 Like

Hey @Lopti!
Just checking in to see if you got it figured out or if you needed any additional assistance?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.