Announcement

Collapse
No announcement yet.

Gun Sight Aligner

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

    #16
    Hey, just do this change in the anim blueprint (AB_ExampleCharacter). Delete the FlipFlop and add another custom event (ExitAim), wired like shown below:

    Click image for larger version

Name:	AimAnimBlueprint.JPG
Views:	395
Size:	170.6 KB
ID:	1690465

    Then do this change in the character blueprint (B_ExampleCharacter):

    Click image for larger version

Name:	AimCharacter.JPG
Views:	383
Size:	327.4 KB
ID:	1690466


    Please let me know if you encounter any problems...
    Gun Sight Aligner

    Comment


      #17
      Updated to v1.1.1

      Change log:

      - Small change in the method of calculation of ironsights. It now uses the node FindLookAtRotation followed by roll adjustment, instead of the dot products, RotationFromAxisAndAngle and CombineRotators nodes to find the direction from rear sight to front sight. The new method works better with the change implemented in v1.1.0 (since v1.1.0, the old method would let the rear sight a bit off depending on its location on the gun in relation to the front sight)

      - Corrected code comments that were outdated since v1.1.0

      - Updated to Unreal Engine v4.24
      Last edited by PeaceSells_; 01-10-2020, 07:53 PM.
      Gun Sight Aligner

      Comment


        #18
        Updated to v1.1.2

        Change log:

        - Fixed: lack of smoothness when cycling between sights while aiming. Before, the interpolations were done through a Timeline in the character and the resulting values were applied in the EventBlueprintUpdateAnimation of the anim bp. Now everything is done in the anim bp, which fixed the lack of smoothness.
        Gun Sight Aligner

        Comment


          #19
          Hello. Is there any way to get your sight aligner to work in a replicated game. The sights work on the server but not on the client.

          Comment


            #20
            Hi,

            Could you tell me more precisely what your're having trouble with? I just did a test in multiplayer mode and the sights worked on server and on all clients (please see the pics below).

            Typically, in multiplayer, the anims themselves aren't replicated, they are controlled locally on the client by their character, but the character on the client is controlled by the character on the server (replicated). It worked in the pics below because each client is controlling his own anims locally, but one client won't see another client aiming down sights, unless you replicate the aim down sights command in the character. But you have to remember that the alignment happens on the FP floating arms, which aren't supposed to be seen by other clients anyway. If you're doing multiplayer with this character, you should add a whole body mesh to him to be seen by the other clients. This whole body mesh doesn't need to align the sights, you just need to add a generic aiming pose to it so, from outside, he looks like he's aiming his gun. Please tell me more preciselly where you're having trouble right now and I'll see how I can help you better.


            Click image for larger version  Name:	multi1.jpg Views:	0 Size:	300.8 KB ID:	1741621

            Click image for larger version  Name:	multi2.jpg Views:	0 Size:	317.2 KB ID:	1741622

            Click image for larger version  Name:	multi3.jpg Views:	0 Size:	316.2 KB ID:	1741623
            Last edited by PeaceSells_; 04-04-2020, 09:47 PM.
            Gun Sight Aligner

            Comment


              #21
              Thank you for your reply. It turned out that there was an error on my part, I was updating the sight transform when I equipped the weapon, so I just had to change the custom event to Multicast and now it works.

              Comment


                #22
                Hey, I'm glad to hear that it's working. If you need anything, please ask!
                Gun Sight Aligner

                Comment


                  #23
                  Updated to v2.0.0

                  Change log:

                  - Added a version for full-body chareacters - 3rd person, True 1st person, etc.

                  - Added reload while aiming.

                  - The IK bones in the Epic's skeleton are no longer used. The project now uses virtual bones instead, which eliminates a few nodes in the anim graph.

                  - Moved the sights position calculation from the character to the gun blueprint.

                  - Added walking sway when walking while aiming, governed in the blueprint by a curve.

                  - Firing anim when aiming down sights is no longer procedural, it's an additive anim sequence.

                  - Moved the sight aligning logic out of the movement state machine and replaced the state machine with a movement BlendSpace. Now it should be easier to just replace the BlendSpace with your own movement state machine.

                  - Reduced the character's walking speed, acceleration and deacceleration to more natural values.

                  - Redone idle, walk and fire anim sequences and added reload anim sequences.

                  - Added a menu screen for choosing between playing the ArmsOnly project, the FullBody project, or exiting the game.

                  - Added a thumbnail for the project in the Epic launcher =)
                  Gun Sight Aligner

                  Comment


                    #24
                    Updated to 2.0.1

                    Change log:

                    - Quick fix: InputMode not returning to GameOnly mode after leaving the menu by pressing Esc - fixed.
                    Gun Sight Aligner

                    Comment


                      #25
                      hi, this kit thingy is really good but i need some help changing the skeleton. ive fumbled to getting it almost done but when i aim the gun flies off behind the camera (it still rotates around when changing sight). yes, i did the VB stuff, and i have no idea why. also the... not aiming stuff works

                      EDIT: btw, im using the just arms stuff
                      Last edited by Nonecares.; 09-14-2020, 05:09 PM.

                      Comment


                        #26
                        Nonecares. Hey, first thing I have to ask is if you have added the sight sockets to tour gun, with X axis pointing forward, etc, as stated in the instructions video. Second, if you have copied the code on the gun - CalcSightsTransforms, etc. to your gun? Also did you do the same regarding character code? Third, is your skeleton hand bone named hand_r? Is the gun attached to it or a socket on it? Is you camera socket X axis pointing forward and Z up? Is it attached to the head bone and is your head bone named head?
                        Gun Sight Aligner

                        Comment


                          #27
                          PeaceSells_
                          1&2: I haven't changed the gun, so i guess no? i've just changed the arms skeleton in the download project (i want to get it working on my skeleton before integrating it). Sorry if ive misunderstood
                          3: The hand isn't called that but I've changed everything that calls for different names im aware of (which if i remember correctly is the anim BP and CalcSightsTransforms)
                          4: The gun is attached to the hand using a socket and its the same name as the original in the mannequin.
                          5: I looked in both the mannequin skeletons and only the full body has a camera socket, im trying to change the arms only skeleton. i might be missing something or im just dumb sorry.
                          6: My head bone's called "Head" (idk if the capital makes a difference so im just saying)

                          Thank you for the help
                          Last edited by Nonecares.; 09-15-2020, 01:21 PM.

                          Comment


                            #28
                            Nonecares.

                            You're right, I've been on the full-body version for so long that I automatically ask about the head and the head socket. They're not necessary in the arms-only version. You're also right about the hand bone, it's only called in the gun blueprint and in the anim blueprint.

                            I'm setting a test project with a custom arms on my end and I'll reply to you again with more details about it.

                            Thank you
                            Gun Sight Aligner

                            Comment


                              #29
                              Sorry for being late, thank you for helping me (x2)

                              Comment


                                #30
                                Nonecares.

                                No problem at all.

                                I've tested the project with 2 different custom skeletons, the ShooterGame skeleton and the FPS Assault Pack skeleton:

                                - ShooterGame skeleton: the alignemnt didn't work, and after looking around for the problem I ended up discovering that this skeleton has 3 "elbows" in his arm, instead of 1. In other words, instead of the default hierarchy:

                                arm->forearm->hand

                                It has this hierarchy:

                                arm->armroll->forearm->forearmroll->hand

                                So the TwoBoneIK node in the project only goes from hand to forearm, thus the hand can't reach the camera properly. Maybe it will align if the TwoBoneIK is replaced by another node that allows the use of more bones, but it would probably still look bad from external view on the arms having all of these joints bending. But, then again, arms-only aren't supposed to be viewed from external view anyway...



                                - FPS Assault Pack skeleton: it worked perfectly, as it has only 1 "elbow":

                                arm->forearm->hand

                                (the twist bones are parallel and not in the sequence, just like in Epic's default skeleton)

                                This skeleton has extra bones for gun attachment, but, as you know, gun still must be attached to the hand or a socket on the hand.



                                The tests were made by opening the original project, migrating the custom skeletons in and replacing, in the anim blueprint, the original skeleton with the migrated one. Then, still in the anim blueprint, I replaced the BlendSpace with an Idle anim of the new skeleton. Then, in the character blueprint, I replaced the skeletal mesh of the MeshArms component with the migrated skeletal mesh.

                                Please let me know how the bone sequence in your custom arms is, because that might be the problem.


                                Thanks
                                Gun Sight Aligner

                                Comment

                                Working...
                                X