Keybinding for asset rotation according to angle snap

Hi,

Here’s what you need to do in order to achieve what you want:

First, let’s bind the input key Ctrl+R. From the top ribbon above Viewport, click on Settings > Project Settings. Once it opens up, go to Inputs which can be found on the left side panel, and add a new Action Mapping as shown in the picture below. Search for the key R and check the Ctrl as well. (I called my input event “RotateCube” but you can call it whatever that makes sense.)

Next, you need to make sure that the Mobility of your Static Mesh cube is set to Movable. Simply select your Static Mesh that is already put into the level, from the right side Details panel, under the transform, you can change its Mobility from Static to Movable. (If you don’t do this your Static Mesh Actor will not move during gameplay.)

225157-cubemobility.png

Finally, you need to define the movement functionality you want for your Cube in one of your blueprints. (You can do this in either PlayerController Blueprints, Level Blueprint, or any other suitable place that keeps your scripting and game logic neat and clean. I’m gonna show you how to set this in the level blueprints because that’s easiest part where we can get a Reference to your Static object. Open the Level blueprint. You can find it from that top ribbon > Blueprints > Open Level Blueprints. Once that is opened, select your Static mesh, it will automatically gets highlighted in the World Outliner which is located by default on the right side of Viewport above Details Panel. Drag your object from the World Outliner into Level blueprint to get a reference to it. Once you get a reference to it in the Level blueprint, right click in any open area in your blueprint, and search for your binded input key which we Called “RotateCube”. Get an event to it and set your blueprint as in the following.

That’s all! Compile and save your Level blueprint. Click Play and whenver you press Ctrl+R your cube will rotate 30 degrees along the Z axis. Similarly you can bind a key to counter clockwise rotation and implemented in a exact same way.

Hope this answered your question.

Is there a way to keybind rotation to a static mesh? For example, if I place a static mesh in my map, I’d like to press CTRL+R to rotate it clockwise via the Z angle according the the current rotation snap settings. So if the current rotation snap setting is set to 30, then every time I press CTRL+R, it’ll rotate 30 degrees clockwise on the z-axis. I can’t seem to find this setting or hotkey binding. Any thoughts? Oh, and it would also be nice to rotate counter clockwise as well.

That was it! Thanks Vizgin. The pics were especially helpful. I was wondering why my mesh wouldn’t rotate, and it’s because I didn’t set it up to be “moveable.” Thanks for the help!