Download

[Question] How do you force the FPS character to gradually look over at a point?

Hi everyone,

I’m trying to set up a system using the FPS character where I can tell the character to look at a target point in the world.

I did some digging and found the blueprint below:

1418c08e8841c247292948c6623c53aa95b0f8d3.png

However, that automatically snaps the player’s camera to that location. I tried to find a way to do it gradually so it feels more like the player is looking in that direction… but I can’t figure that part out.

Does anyone have any idea of how that might be accomplished? In an ideal world, I figured there would just be a function of, “Set Control Rotation Over Period of Time”

Take a look at the Interpolate node. It does a smooth transition between two values. What a character is currently looking at, and what you want them to look at for example.
I think I learned how to use it by taking a gander at the security cameras in the blueprint office example.

Thanks, Vaporlynx,

I’ve tried using the Interpolate node a bit, but it seems like it’s still just snapping. I’m fairly new to using it, so it could be that I am doing something wrong. Here is my current blueprint:

64d620c432f13b86c5c22e29b4a165a36e030225.png

However, even with that, the camera is still snapping to the point instantly instead of doing a gradual turn. Is there something that I’m missing with how Interp To works?

you need use a tick event.

Your missing delta time.
The interp node needs to know how fast much time each frame is taking, so that it can keep the speed consistent. You can wire up the Delta time output from event tick, that is what I have done when I need to use an interp node.

I thiiink there is also a world delta seconds variable that might do the same thing, but I have not tried using that.

Thank you erWilly, Vaporlynx, for your help so far.

I’ve got a sample of it working now, but I just need one bit more of help.

Here is a sample of the blueprint I have:

I’m replacing having it done on an event tick by having there be a branch off of a condition being false, and then a delay that simulates a tick. I’m doing this because I want to put this in a blueprint macro and not in the event tick of a level blueprint, as I’ll be doing this frequently in the FPS game.

My only problem right now is figuring out when the rotation for the player is complete, or near complete. I’ve experimented with a few things to set as the condition on the branch, but none of them have panned out.

Do either of you know of a good method to tell when an Interp’s current mark has reached its target mark?

I move the player to x place and stop it.

Look the example

I wait a second to stop, but you can check if the roracion is done to close the gate.

You can also use a timeline to control the alpha value. I use this to rotate the back of the npc.
1e7e2e29cf614a1678113dff5b092446103a2237.jpeg

Thank you guys for all of your help!

Using the timeline as the check for the interp was what finally got everything working. Below is how it currently looks, with the guts of what’s moving the player in a macro in the first shot, and what the macro looks like in practice in the second shot.

This is going to be extremely useful in the project I’m working on, so thank you guys again for all of your help and your useful examples!

You should also be able to simplify it a bit by using the RInterp node instead of converting a VInterp to rotation, and using the very useful “Find look at rotation” node :slight_smile: So the “Get actor location” at the bottom left would be the location of the actor you want to look at:

Thank you for the help, Thomas! Those two nodes are extremely useful and this new method is a lot simpler and more streamlined.