Announcement

Collapse
No announcement yet.

Attach Weapon to Socket not working.

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

    Attach Weapon to Socket not working.

    Hi,

    I read several Tutorials about Weapons and how to add the basic funcionality but at some points the tutorials are inaccurate or won't work.
    So i mixed up some tutorials to make my own way to implement weapons but there is currently a big problem.

    In the Armes Mesh I added a Socket for my weapon, added a preview mesh and everything looks great.
    Click image for larger version

Name:	socket.JPG
Views:	1
Size:	60.8 KB
ID:	1137269

    So I made a simple Function to attach a StaticMeshComponent to the socket.
    Click image for larger version

Name:	changeWeapon.JPG
Views:	1
Size:	57.8 KB
ID:	1137270

    But ingame, there won't appear any weapon mesh.
    Click image for larger version

Name:	ingame.jpg
Views:	1
Size:	91.3 KB
ID:	1137271

    So where is the problem? Is it the Mesh? Because I rotated the socket in the preview to make it fit to the arms.
    Thanks for your help!

    #2
    How or from where do you get the weapon mesh? -> because in the static mesh you have to set the mode to "moveable". Otherwise it wont work! So for example: when you add the weapon mesh to the component tab you can change the mode and after that you can attach it to the socket.

    So you could create a new blueprint with the weapon mesh in it and in there you can change the mode + after that you can spawn it in your other bp
    Last edited by fighter5347; 08-08-2014, 12:21 PM.

    Comment


      #3
      The mesh comes from the content browser. I also tried to use a skeletal mesh but nothing happens. I also tried to your tutorial about attatching stuff to a socket. It also won't work.
      Somtimes - not every test play - i reciev 1 error while playing. Seams like the socket is missing sometimes. This is very strange.

      Comment


        #4
        Originally posted by KAEPS133 View Post
        I also tried to your tutorial about attatching stuff to a socket. It also won't work.
        Have you done it exactly the same? (so with the level blueprint) -> when not, then try it out, because then we will see if it is a problem with the socket or your upper setup

        Comment


          #5
          I' ve done it exatcly the same.
          This is the Tutorial i was reading and trieing to recreate: http://creategamesfromscratch.blogsp...nd-weapon.html

          He is just using a static mesh from the content browser. SkeletalMesh also won't work. I'm not recieving an error with this but the gun isn't visible.

          Comment


            #6
            Do you have any way of checking if the thing even spawned? Your setup isn't exactly ideal to be honest. It's not a prime example of oop. But it's not your fault, since you just followed a tutorial.
            You call "SetStaticMesh" on your weapon and then you attach it, but the question is, what is that weapon variable and when do you actually spawn the weapon?


            I would rather spawn a new weapon (or unhide a previously spawned one) and then attach it to the socket.

            Comment


              #7
              Hey,
              sorry for the late reply. I'm now working with another weapon system. I'm using weapon meshes that includes the arms - like the blue placeholder and just set the '1pMesh' to my new weapon.
              Changing some variables for recoil, Ammo and so on and everything is working fine. A lot easier than the tutorial. Maybe not the best solution for everyone but it's working fine for me.

              When I'm ready with my sytem and it's working perfekt I'm making a short tutorial.

              Comment


                #8
                Originally posted by KAEPS133 View Post
                Hey,
                sorry for the late reply. I'm now working with another weapon system. I'm using weapon meshes that includes the arms - like the blue placeholder and just set the '1pMesh' to my new weapon.
                Changing some variables for recoil, Ammo and so on and everything is working fine. A lot easier than the tutorial. Maybe not the best solution for everyone but it's working fine for me.

                When I'm ready with my sytem and it's working perfekt I'm making a short tutorial.
                how did you resolve this? I have the same problem

                Comment


                  #9
                  The object needs to exist in-game (an instance of it needs to be in the world somewhere) for that type of setup to work I believe.

                  Comment


                    #10
                    Your weapon has "Simulate Physic" checked by default. Uncheck it, and make sure to set physic simulate back to on in Blueprint when want to drop it.

                    Comment

                    Working...
                    X