This is the basic OnSeePawn of a turret. They already pound me as soon as I’m around the corner which is a little too drastic. What can I put inbetween to give it a slower rotation and 1 second delay before shooting? My rookie combinations of Lerp and Finterp didn’t work, but I know it’s something of that kind. (Giving it a simple Delay would slow the firing rate down to 1 second etc.)
What you want is the RInterp To node.
Here is a quick and dirty example:
PS: this example should not be used, since it’s constantly making all the calculations. You should use a branch or something that stops the calculation once the rotation approaches the desired rotation.
I only used Tick just to demonstrate how to use the node. If one would use the Tick function, then a gate or something would be required in order to improve performance.
Here is an example of the operation using a Timer instead:
Imagine that the “Y keypress” event is your OnSeePawn event.
Thanks! The question is, how do i do it? Reconstructing from this specific image didn’t work.
You asked for a slow rotation and I answer which node you should use: RInterp To.
- Feed the “target” of the node with your “Find Look at Rotation”
- connect the “current” pin with the current turret rotation (GetWorldRotation).
- connect “Get World Data Seconds” to Delta Time
- Ajust the rotation speed you want.
- exec the node until the “Find Look at Rotation” rotation and the current turret rotation are almost the same
- Once they are the same, start your firing procedures
I don’t think I need to rewrite the whole thing for Event Tick. Mine is coming from OnSeePawn, not Event Tick. Might take a full year to understand this, because my question was to hang something simple between SetActorRotation and Find Look At Rotation. So yeah, will take a long time to understand this.
Okay I see now, How simple is it to move the turret up slowly when they spot me? I tried to Lerp with a Timeline (Do Once), but they teleport. I will try from your Blueprint. Thanks!
Yeah the latter one worked - moving smoothly now.