So I setup some rotation for my npc to look at my character:
Which works beautifully, however how could I make the rotation slower? He instantly snaps to my location, I want it to be a bit slower.
So I setup some rotation for my npc to look at my character:
Which works beautifully, however how could I make the rotation slower? He instantly snaps to my location, I want it to be a bit slower.
That’s because you’re setting the rotation to the new value.
Instead, add an RInterpTo node. Feed the “current” node with the actor’s current rotation, and the “target” with the desired rotation.
You need to then either open a gate to your Event Tick, or create a Timeline node and trigger the timeline, and let that fire off the actual Set Rotation function. Also make sure RInterpTo has a proper reference to World Delta Seconds.
What this will do is every tick (or every pulse of the timeline, whatever) the actor’s rotation will be set to a new value which is somewhere between where the actor is and where it should be (i.e. it continually gets closer), scaled by the given interpolation speed and adjusting based on World Delta Seconds (so the rotation is consistent even as the framerate changes).
I got this so far:
It works slightly however if I lower the interp speed the rotation on the npc gets glitchy. >50 seems to work but its quite fast and I want it slow. I assume this is where I use the Gate or Timeline. Problem is I have not used them before, I tried looking at them and I think need a little help Rhythm. How can I implement a Gate or Timeline so I can slow down the rotation rate?
Okay, so first, I think maybe you’re mixing up your rotations.
Control rotation rotates the camera, and IF you configure the actor to use it, the actor as well. But you’re not rotating the actor, but the mesh…? Why is that? Is it intentional that you’re rotating the mesh independently of the actor? Either way, you need to feed the Current node with the rotation of WHAT you’re applying the rotation to; i.e. if you want to rotate the actor, feed it with a Get Actor Rotation. If you want to rotate the mesh, feed it with a Get Component Rotation of the mesh (or whatever that function is). Since the RInterpTo is updating a rotation every tick, it needs to see the progress it’s making every tick!
As for the gate, it’s simple. Create a new Gate (it’s under Flow Control). Whatever execution is feeding “set rotation”, have it instead feed the “Open” node. Now, drag your Event Tick’s execution path to the “Enter” node. The “Exit” node should trigger the Set Rotation function.
You also need to Close the gate somehow; this will depend on what you’re doing (i.e. when you want to stop applying it depends on the gameplay reason for having the player rotate)
Thanks a lot Rhythm, I did not have to use the gate (works the way I want it too). I used the actors rotation.