x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Keybinding for asset rotation according to angle snap

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.

Product Version: UE 4.17
Tags:
more ▼

asked Dec 27 '17 at 12:29 AM in Using UE4

avatar image

triangle_soup_46
3 2 2

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

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.)

alt text

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.)

alt text

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.

alt text

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.

more ▼

answered Dec 27 '17 at 05:10 AM

avatar image

Vizgin
1.4k 10 10 17

avatar image triangle_soup_46 Dec 30 '17 at 05:18 AM

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!

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question