Would anyone mind helping me with the following? Any help would be greatly appreciated as I’m unsure which exact nodes are required due to limited experience inside UE4.
I would like to drive the rotation of a static mesh (Z-Axis/Yaw) based on the input from the player controller (Gamepad Right Thumbstick X-Axis). The static mesh will be used as a rudder, which will have it’s angle of degrees clamped relative to -55/55. Currently, I’m able to swing said rudder fully one way or the other but I would like to achieve finer control based on the input from the Axis.
I hope I’ve explained myself clearly.
I was reading over your questions and I have an example that may be able to get you pointed in the right direction. I hope that this information helps.
In this picture I have gone to the project settings and added an Axis Mapping. From there I named it rudder and assigned it a key (in this case a the Right thumb stick).
In this depiction I have added the axis mapping that I made above and I am rotating the actor to the left and right depending on the direction that is press on the thumb stick. As a note I had to enable player input. This can be found in the class setting within the details panel.
Make it a great day
First of all I would like to thank you for your help. Using your example I was able to achieve a result but not the perfect one as intended (for my project, at least) No doubt my own fault with the lack of details or an oversight I didn’t account for.
Using your example I was able to make the rudder rotate based on input from the controller’s axis, but once the axis input was released (analog stick was centred) the mesh wouldn’t automatically centre in turn and would only begin to rotate in the other direction once the polarity of the axis was reversed (not sure if that’s the correct term).
In layman’s terms. Is there a way to slave the static mesh’s rotation based on the input from the axis, at all times. For example:
Anolog input full left - mesh rotates fully to the left
Anolog input 50% left - mesh rotates 50% to the left.
Anolog input centred - mesh rotates to centre.
Thanks again for your help and I hope that I’ve got view across without knowing the correct terminology.
Many thanks, again,
If you would like the movement to be more 1 to 1 with the controller input you could try the blueprint below.
- Axis Value returns a number between -1 and 1 depending on how far the thumb stick is tilted.
- A Lerp evenly blends between two values
- The Alpha value on the Lerp node accepts inputs between 0 and 1 (You could think of this like a percentage 0 = 0% and 1= 100%)
- Branch statements are for the most part the same as an “if” statement in code
- Greater than nodes return True or False
- Absolute value node forces the number to be positive
How this works:
If the Axis Value is greater than 0 the branch node will return true and the Axis value will be used to lerp between 0 degrees and 55 degrees. However if the Axis value is not greater than 0 the branch will return false and the axis value (that is currently negative) runs through an absolute value node (so that it returns a valid number between 0 and 1) before lerping between 0 degrees and -55 degrees.
Hello again Rudy,
This is absolutely the result I was after and honestly cannot thank you enough for the in depth details on what function the individual nodes have, the example blueprints too! Being new to “coding” I would just like to say that UE4’s Blueprint system is fantastic and I cannot wait to learn more!
Once again, many thanks,