Set actor's local rotation
Hello mates, as title suggest, how can i change and set actor's local rotation? I have notice that there is a node name AddActorLocalRotation, that is a nice node but if i want to rotate an actor around it's axis for an exact of 45 degrees and then stay like that, AddActorLocalRotation node is pretty hard and tricky to use. Thank you all in advance
asked Dec 30 '14 at 08:46 AM in Blueprint Scripting
There are a couple of simple solutions depending on the kind of effect you want. The first would be to use AddActorLocalRotation as you are, which gives a sort of "snap into place" effect as the actor's rotation updates instantly. Another option, which gives a smooth transition between the current rotation and the new rotation is to use Set Relative Rotation along with a timeline and a LERP node. The LERP node controls the transition from one position (A) to another (B). By setting a timeline with a float track from 0-1 (or whatever duration you choose), you can wire that value to the alpha of your LERP. Using a variable to get the current rotation of the actor (set in the construction script), you can break that into its pitch, yaw, and roll components. Wire the axis you want to rotate on to the A of the lerp and the amount that you want to rotate by to the B. Use the return value of the LERP to make a new rotation that gets wired into the Set Relative Rotation node. You can then wire the Update exec pin of the timeline to the Set Relative Rotation. If you want it to be able to continue rotating along that axis you just need to wired the Finished pin of the timeline to Set variable node for the variable storing the initial rotation. This way when it finishes updating, the new rotation becomes the starting rotation for the next run of the timeline. This screenshot should help explain how to set the nodes up inside your blueprint.
answered Dec 30 '14 at 10:36 PM
In blueprints there is the "Set Actor Rotation" function. That should do it.
answered Dec 30 '14 at 09:14 AM
Hello CKong! I recommend you to use text like "set *" for context sensetive search
For example "Set rotation" will show you setting of Absolute(Set World Rotation) and Relative(Set Relative Rotation) to parent rotations.
Also, you can use "Rotation" in search to show every node with "Rotation" like getters/setters and offsets
answered Dec 30 '14 at 01:27 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here