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.
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.
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.
I don’t have the editor in front of me right now and not sure whether I saved the blueprint anyway 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.
Hi
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)
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