Announcement

Collapse
No announcement yet.

Smoothly Blended FPS Camera Recoil

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Smoothly Blended FPS Camera Recoil

    Hey guys

    I'm relatively new to programming but feel like I've done a pretty thorough look through on these forums and the rest of the internet on this specific issue.

    What I'm attempting to do, is modify the First Person Template First Person Character Blueprint to add recoil to the players CAMERA, so that when a bullet is fired, the whole screen jumps up vertically.

    So what I've done so far is: Click image for larger version

Name:	eOiF8J6.jpg
Views:	1
Size:	29.3 KB
ID:	1147693

    I've looked into the linear interpolate functions and stuff, but I'm guessing the Add Controller Pitch Input is only being called ONE time, every time the fire event is executed.

    My question is how to make the movement of the Add Controller Pitch Input be a smoothly blended input (Possibly with even functionality for it being stronger when it starts and tapering out at the top), instead of the jerky jump to "-0.5" that it currently is based on the screenshot of my nodes

    Do I need to create some kind of loop system that is called once when Event Fire is called that is separate from this other chain of SpawnActor that I already have going?

    Thanks for any help guys
    Attached Files

    #2
    Maybe I read your question wrong; why don't you just add an impulse to the camera rather than the controller?
    Marketplace Assets

    Advanced Mobile Input: Marketplace Page | Support Thread ――― Easy Input Remapping: Marketplace Page | Support Thread
    Multiplayer Blueprint Chat System: Marketplace Page | Support Thread ――― Closing Credits System: Marketplace Page | Support Thread
    Minesweeper Template: Marketplace Page | Support Thread ――― Maze Creator: Marketplace Page | Support Thread

    Comment


      #3
      Hey dude, sorry I'm a little new to the blueprint system.

      What do you mean by add an impulse to the camera? Arent the camera and the controller the same thing?
      Reading the documentation on impulses, it says its good for one instant burst, which is kind of the behaviour Im trying to avoid.

      I feel like im on the right track with the Controller Pitch, since its the same thing that you control when you get the mouse yaw/pitch events, I just want it to smoothly blend through a value, not jerk to the end value. I could be totally wrong though!

      Thanks for reading though

      Comment


        #4
        Lerping could work but I wouldn't do it; the problem isn't moving the controller's pitch by 0.5 in a single frame (that's not even all that much), it's that without a smaller cooldown after the fact it feels like it stops too abruptly.

        What you might instead try is using a very short Timeline node with a float curve that goes sharply from 0.5 to 0.01 or something, and have the Update pin feed your Add Yaw. That way when you fire, you get that snapping value and then a few more frames of much smaller change after it which feels like the recoil slowing to a stop.

        Comment


          #5
          Hey Rhythm,

          Doing a quick read through on timelines, it looks like it will let me do exactly what I am trying to do! Thanks so much, I just hadn't heard about them yet!

          Going to play around with them tonight and see what I come up with, will let you know if I get something nicely working

          Thanks again all!

          Comment


            #6
            Originally posted by VaSSiLi View Post
            Hey Rhythm,

            ... see what I come up with, will let you know if I get something nicely working

            Thanks again all!
            Yea, sure mate. Thanks for the heads up. I would want to do the same as you. I still can't manage to make it working even with timelines. Would be nice to see at least 1 working example.

            Comment

            Working...
            X