Download

Making an actor constantly rotate using +=

OK, the title might be a little strange, but please bare with me. I’m trying to make an actor (The class I used as a base for my blueprint) to rotate constantly.
One way I know how to do that from a pure programming standpoint is to get the actor’s rotation axis in a variable, then += a value. so say you wanted your actor to spin at a constant rate, you’d do this in c++:




float x = actor->getRotationX();

x += 0.5f;



this code will rotate the actor 0.5 radiant in the X axis. I want to do that in a blueprint, but there’s no += operator. Can that be done in blueprints or would I need to use C++? if I need to use C++, how would I convert the current project I have to a C++ one without restarting? The project I’m asking about right now is blueprints only as far as I know. If you could answer this for me, I’d greatly appreciate it.

Blueprint for the code you posted is similar to this:

To add C++ to your Blueprint project, go to File Menu and select Add Code to your Project…

Look into interpto tutorial. Simple incrementing values is very FPS dependent, interpto is much better for this.

For converting to C++ from BPs you can start with translating some basic bp graphs int custom blueprint nodes written in C++.
Conversion of whole project should be easy if you know C++ and have all functionality done in BP nodes.
But you probably will stop somewhere mid way, as this is IMO most optimal solution to unreal. Mix of BPs and C++ gets best from both worlds.

Thanks for responding quickly.

Not sure what engine version you are using, because there’s no right pin in on the set node, there’s only one and it’s on the left side, there’s no way to connect it to another node on the right side to try and make what you suggest work. please let me know what you think. I am using engine version 4.6.1