Announcement

Collapse
No announcement yet.

Fire Projectile | FPS / TPS difference

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

    Fire Projectile | FPS / TPS difference

    I have a shooter project where the player can toggle between first person and third person. The only hiccup I am holding my breath for at this point is that when I switch from FPS to TPS my aiming is slightly off.

    I am spawning a projectile from my gun's muzzle which fires straight ahead. When I toggle to third person the camera is set to the right a little so the projectile does not actually fire at the center of the screen.

    My question is do I attempt to adjust where the projectile is firing or do I adjust where the camera is looking? If I try to adjust the projectile, it will technically be firing slightly off center which could cause an undesirable look. If I try to adjust the camera, the camera will not be facing straight.

    Just curious if anyone else has had this dilemma and what did you do to accommodate the difference?

    Any input would be lovely! THANKS!

    Matt

    #2
    this may be useful to see how another game approaches projectiles: https://www.youtube.com/watch?v=ZwWoA6B9VfQ

    Comment


      #3
      Setting up offsets is a tricky business, just be sure to select an approach and stick with it, until you are informed that it won't work well and you'll have to change it.

      Comment


        #4
        The most important factor is "is the player having fun?"

        To that end, designing the game in a way that eliminates frustration should always be a top priority.

        In a shooter, having the in-game gun aim at something other than what the player believes they are aiming at will be a constant source of frustration.

        My advice is to always fire shots at center-screen, regardless of camera perspective. This will require some setup in third-person to work effectively if you want the shots to exit the gun's muzzle as projectile actors (rather than simple invisible traces outward from center screen) but it can and should be done. For the player's shots to be landing off-center because of the camera would just be bad game design, IMO, realistic or not.

        I have discussed my method for achieving third-person aiming in another thread, but the short version is "first, trace outward from center screen to determine what surface the camera's center / reticle is resting over. Then, perform the actual shot math (either as a trace or as an orientation of a projectile actor) using the direction vector from the gun's muzzle socket to the hit result of the initial trace. This way shots will always fly from gun barrel to whatever object the camera is resting on, irrespective of camera position (relevant in third person since if you use a static offset, how accurate it is will depend on the distance between the camera and the object it's looking at; further objects require less offset to be accurate than closer ones due to perspective projection).
        Last edited by RhythmScript; 08-26-2015, 10:49 AM.

        Comment


          #5
          I agree with RhythmScript, always have the aim come from the camera's viewpoint.
          Check out my itch.io page, I'm really excited about it.
          https://kinos141.itch.io/

          Please check out my AI package: Action AI System Feat. Stealth
          https://www.unrealengine.com/marketp...m-feat-stealth
          or get it from itch
          https://kinos141.itch.io/action-ai-system-feat-stealth

          Comment


            #6
            Wonderful! Thank you all for your input! I will attempt to set up a trace system. I know how trace systems work, but haven't attempted to cause any damage with them.
            Correct me if I'm wrong: I would do a line trace from the center of the camera out to the hit object, if the hit object is say a player character then apply damage?
            Did a bit of searching last night and couldn't really find what I was searching for. Any tuts floating around out there with this type of setup?

            With this type of setup, I assume I will need to rework my projectiles.. If it is a line trace, how easy is it to set up a tracer effect with particles or other?
            Thinking about it, this is really what I want, because if I am firing actual projectiles there would technically be a delay from the time the projectile is spawned and when it hits unless the speed is set pretty high.

            Thanks again for all the info guys!

            Matt
            Last edited by mdmoberly; 08-27-2015, 09:26 AM.

            Comment


              #7
              Originally posted by mdmoberly View Post
              Wonderful! Thank you all for your input! I will attempt to set up a trace system. I know how trace systems work, but haven't attempted to cause any damage with them.
              Correct me if I'm wrong: I would do a line trace from the center of the camera out to the hit object, if the hit object is say a player character then apply damage?
              Did a bit of searching last night and couldn't really find what I was searching for. Any tuts floating around out there with this type of setup?

              Thanks again for all the info guys!

              Matt
              I was just doing this in my project.

              1.
              In your character blueprint add float or int variable and name it health or something like that.

              2.
              If you use line trace or projectile break hit result and cast to your character ,object pin connect with hit actor,on your cast node you have pin called as.......(name of your character) from that pin search for "Set health"(this is the variable we created in your character blueprint) and then you can set the value.
              Assets: Military Ammunition (Released)
              Plugins: BlueManBPFunctionLibrary C++ plugin (Free), Blue Man Vehicle AI Plugin (Released), Air Resistance C++ Plugin (WIP), Blue Man Vehicle Physics Plugin (Marketplace)
              Projects: Giants Of Destruction

              Comment


                #8
                Originally posted by Blue man View Post
                I was just doing this in my project.

                1.
                In your character blueprint add float or int variable and name it health or something like that.

                2.
                If you use line trace or projectile break hit result and cast to your character ,object pin connect with hit actor,on your cast node you have pin called as.......(name of your character) from that pin search for "Set health"(this is the variable we created in your character blueprint) and then you can set the value.
                Yeah, that is what I figured I'd have to do.. Not hard at all, just more concerned about the visual effects I can do with a trace system vs firing actual projectiles.

                Thank you for your reply!

                Matt

                Comment

                Working...
                X