Rotating object blueprint (acceleration)

Good day,

I have a question about rotating objects/Blueprintsactor.

I have a rotary wheel and If I press a button (ingame) the wheel should go faster and if the wheel reach “max” speed,

the wheel should keep his “max” speed until I press the button again than the wheel should slow it down.

I look in many forums and I have the Idea to use the “Timeline” in Blueprint, but with that (Vector or Float function) I only can accelerate the wheel and then it’s decelerate till it stands still.

Another option would by matinee but there I only can accelerate and hold max speed for for example 10sec.

But this wheel must rotate longer for example 10sec, and there is the problem about the deceleration If I press the button again.

I also try about the function “Addlocalrotation” and hang them in succession

Add local rotation: X=7 delay: 0.2 Add local rotation: X=-1 delay: 0.2 Add local rotation: X=-2 delay: 0.2

but then the wheel spinning itself to the Y and Z vector which is also not a good solution.

The button is no problem. I use a trigger for this and the call event funtion.
Right Now I have a rotary wheel by matinee actor but it’s not accelerate, but is rather going to max speed and stand still immediately.

So I really need your help :smiley:

Yours faitfully

Have you tried using a Rotating Movement component? It’s great for simple rotation. If you adjust the Rotation Rate of this component, you should be able to get the speed up/speed down that you want.

Try something like this:

Pushing the button (in the is case the “1” key) will set the TargetSpinRate to the max speed and it will start accelerating. Pushing it again will set the TargetSpinRate to the min speed and start decelerating.

To improve on this, you could make the Max and Min Speeds into variables that you could set per instance. Also, on the FInterpTo node, the Interp Speed is controlling the rate of acceleration/deceleration, so if you change that or make it a variable, you can have more control over the rate of change in the speed.

Thank you very much!
You guys are awesome, I learned here so much and I can apply it to most of my works.
Big Compliment!!!

But I have one question,
Can you send me this blueprint file? or can you say me how the names of these “Blueprint buildingblocks” are?

I am very bad in finding these script blocks in Blueprint.

I do not need the blocks where you can see the name of it for example “Break Vector”
but how can I find this “Variable” “Rotation Rate”?

or is the Blue thing who called “Rotating Movement”? the mesh who should spinning?

and what is with this block between the “Branch” “Target Spin Rate” and “Break Rotator”? with 2 green and 1 Red dot?

Have a beautiful day :smiley:

I don’t have the editor in front of me right now and not sure whether I saved the blueprint anyway :stuck_out_tongue: Let me see if I can answer your questions though so you can build it yourself (best way to learn too!)

First important thing is to make sure you add the components (Components Tab, upper left). You’ll need to add:

  • Static Mesh - This will be your visual for your rotating thing, in your case, your wheel mesh
  • Rotating Movement - This is just a component that simply makes a blueprint rotate. It has settings for speed etc (Rotation Rate is one of the settings that belongs to this component.)

You’ll also need to add those two float variables, TargetRotationRate & Delta

Here’s the logic of how this works: Pushing the button will swap between setting max speed or min speed as a target speed. Then Tick event will change the Rotation Rate (speed up or slow down) until it matches the target speed. Then it stays at that speed until you click the button again.

Your questions:

  • As I mentioned above, Rotation Rate is a setting on the Rotating Movement component. Drag the Rotating Movement to the graph, then drag off that to access Rotation Rate.
  • That block you asked about is “Not Equal”. This checks if the current Rotation Rate is the same as the our target. Basically, for performance sake, you want to avoid doing stuff every Tick as much as possible. So this is just saying “Are we at our target? Good. Don’t do anything.”

Oh, one last thing. In this example, I used Yaw, so the blueprint will rotate like a typical pickup item or like a carousel. In your case, you might need to change to Roll or Pitch depending on what direction you want your object to rotate.

Good luck!

Thanks for respond,
Thank you very much, this helps a lot.

I created it so that If I press a button ingame the whole procedure will start.

Now is the last point to add some photorealistic texture or very good looking. Let’s see what we can find

Thank you very much

Hi :slight_smile:
I’m trying to reproduce step by step.
I understand the course of action but nothing happens when I tap on 1 (num1). I’m tying with a simple cube (capture 1)

You are the only post I found that is related to my research for a very simple project (capture 2)

219078-highresscreenshot00000.jpg

I saw one thing you missed. Connect the “Event Tick” with the “Set Delta” Variable

I found my old Project, the rest you have is the same as mine.

Maybe that helps

Wow thank you. Well it does not change anything. I am thinking, ultimate question… what are the default values ​​of “Delta or TargetSpineRate” variables ? If I find solution I’ll do a video tutorial hehe

sorry for late respond, I can, in the afternoon, look what my Values are and write it here.

But at least to be sure, you create a “own” Blueprint Class for this and set it to movable, right?

You set it to your Own Blueprint class?

My Values are all 0 and they changed it by itself

Hi.

Is there a way to maintain the current speed when releasing the key? And resume speed to max value by pressing the key again?

Yours faitfully