Announcement

Collapse
No announcement yet.

Weapon Swapping?

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

    #16
    You have to think of a data structure for weapons that stores the weapon mesh so you can easily exchange the meshes.

    Comment


      #17
      How about a scroll wheel weapon array? Store all the meshes in a array and just swap them as needed. Scroll input +1 or -1, add the axis value to the index. If the index is less than 0 then set the index to the array length or if the index is greater than the array length set the index to 0, otherwise set the mesh to the index.

      Click image for larger version

Name:	LoopingScrollWheelWeaponArray.PNG
Views:	1
Size:	255.9 KB
ID:	1114000

      Comment


        #18
        Originally posted by Tactical_Beard View Post
        How about a scroll wheel weapon array? Store all the meshes in a array and just swap them as needed. Scroll input +1 or -1, add the axis value to the index. If the index is less than 0 then set the index to the array length or if the index is greater than the array length set the index to 0, otherwise set the mesh to the index.

        [ATTACH=CONFIG]106889[/ATTACH]
        Thanks btw, I've replicated your image there, but when I start the game, now my pistol doesn't even appear, and scrolling the wheel doesn't do anything, here are some images to state what I'm saying.

        Click image for larger version

Name:	Jkhjn2D.png
Views:	1
Size:	633.0 KB
ID:	1114003

        Click image for larger version

Name:	zP6CyQt.png
Views:	1
Size:	463.9 KB
ID:	1114004

        When I fire, I also get an error.

        Click image for larger version

Name:	2Bepeo1.png
Views:	1
Size:	416.7 KB
ID:	1114005

        Comment


          #19
          You missed a link.

          Click image for larger version

Name:	Capture.PNG
Views:	1
Size:	247.3 KB
ID:	1114006

          See if that works, if not check that the array is populated. Add a print string with the string set to the scroll wheel value to make sure its firing properly. I'm not sure why your set skeletal mesh function doesn't have the reinit pose bool, this may be the reason for the error.
          Last edited by Tactical_Beard; 08-18-2016, 05:27 PM.

          Comment


            #20
            Originally posted by Tactical_Beard View Post
            You missed a link.

            [ATTACH=CONFIG]106914[/ATTACH]

            See if that works, if not check that the array is populated. Add a print string with the string set to the scroll wheel value to make sure its firing properly. I'm not sure why your set skeletal mesh function doesn't have the reinit pose bool, this may be the reason for the error.
            I've fixed the missing link but there's no "Set Skeletal Mesh" with the Reinit Pose Bool, might be because of the UE version? I'm the .11 version.

            Comment


              #21
              Here's the array populated by the way.

              Click image for larger version

Name:	dSAEIhs.png
Views:	1
Size:	438.8 KB
ID:	1114007

              Comment


                #22
                4.12.5 here, can you call a reinit pose function? Or may be try to manually set the pose before or after the weapon swap.

                Comment


                  #23
                  try the way I suggested . Im at work at the moment but when I get in tonight I'll post the screenshots

                  Comment


                    #24
                    Originally posted by EniGmaa View Post
                    try the way I suggested . Im at work at the moment but when I get in tonight I'll post the screenshots
                    I can't access my project today but I will be waiting for your further explanation + screens possibly.

                    Comment


                      #25
                      The only way to get thios working for me was to have all the Child Blueprints of the weapons IE RiflePU vs RifleBP.. attached to the player and hide them...
                      then used hide and unhide for each action... at the moment i see you using only FP_GUN as a base point for ALL weapons..

                      the issue i see is when you attach actor and remove its the first ORGINAL BLueprint or skelemesh...
                      remember things have a hard time removing the Memory location of the object and replacing it.. this is what potentially what you are doing

                      When you hide and unhide it wont ever but may cause collision issues later if not done right
                      using the SINGLE point of place and replace child actors may work with instances of the weapons... as removing them it still has ref to the orginal parent..

                      Love the logic though using arrays and stuff obervesly the efficient way to go...

                      Comment


                        #26
                        Originally posted by Ozcorps View Post
                        The only way to get thios working for me was to have all the Child Blueprints of the weapons IE RiflePU vs RifleBP.. attached to the player and hide them...
                        then used hide and unhide for each action... at the moment i see you using only FP_GUN as a base point for ALL weapons..

                        the issue i see is when you attach actor and remove its the first ORGINAL BLueprint or skelemesh...
                        remember things have a hard time removing the Memory location of the object and replacing it.. this is what potentially what you are doing

                        When you hide and unhide it wont ever but may cause collision issues later if not done right
                        using the SINGLE point of place and replace child actors may work with instances of the weapons... as removing them it still has ref to the orginal parent..

                        Love the logic though using arrays and stuff obervesly the efficient way to go...
                        Got an example of how you did it? That way sounds interesting too, seems more simple.

                        Comment


                          #27
                          ok so first spawn youre weapons like normal .

                          Click image for larger version

Name:	90f805cbd945464f935c71f2c03facf9.png
Views:	1
Size:	197.5 KB
ID:	1114049

                          so here in the screenshot i am spawning an assault rifle, and a rocket launcher both in the weaponSocket Location.

                          now i simply set one of the meshes to be hidden. in this case the rocket launcher because i want the assault rifle to be the default primary weapon

                          Click image for larger version

Name:	ccf6707c5f4840b49c68a001ee354e57.png
Views:	1
Size:	229.3 KB
ID:	1114050

                          then its just a simple case of hiding one and showing the other when you wish to swap.

                          Click image for larger version

Name:	3287a0d43cd94564ae5352d587b702cb.png
Views:	1
Size:	146.4 KB
ID:	1114051

                          of course if you want more than two weapons you can simply use an array or enum to set the weapons visibility like others have suggested.

                          here is the result



                          hope this helps.

                          P.S you can tell i do too much programming now . look at the video upload title im so used to camelcasing i just do it automatically now without thinking and i actually find it hard to write normally :-p
                          Last edited by EniGmaa; 08-19-2016, 02:33 PM.

                          Comment


                            #28
                            EniGmaa - You beat me too it lol NICE setup too

                            is it worse to do it in the Animation BP... ie bring the mesh ref over to be hit by notifys if you are using holster and armed animations

                            and

                            BlizzKrut - Look above =)

                            Comment


                              #29
                              Originally posted by Ozcorps View Post
                              EniGmaa - You beat me too it lol NICE setup too

                              is it worse to do it in the Animation BP... ie bring the mesh ref over to be hit by notifys if you are using holster and armed animations

                              and

                              BlizzKrut - Look above =)
                              hehe thanks. no there are multiple ways to do it. i was just showing him the simplest way that was like his original setup in the first post. and also because he said "i dont care about animations i just want it to switch"

                              Comment


                                #30
                                Originally posted by EniGmaa View Post
                                hehe thanks. no there are multiple ways to do it. i was just showing him the simplest way that was like his original setup in the first post. and also because he said "i dont care about animations i just want it to switch"
                                Thank you very much, I'll try this tomorrow when I'm with the project and I'll post the results here.

                                Comment

                                Working...
                                X