How To Attach A Weapon To The Player | Give The Player A Weapon - Unreal Engine Tutorial

Поделиться
HTML-код
  • Опубликовано: 8 сен 2024

Комментарии • 116

  • @AshuraToF
    @AshuraToF 2 года назад +66

    I'm currently a student in a video game school, in Game Design, speciality Level Design. I'm bad at programming so I follow every of your video to learn how to code on Unreal Engine. I can't thank you enough for all the good stuff you're uploading, you're a gold mine. Keep up the amazing work!

    • @MattAspland
      @MattAspland  2 года назад +7

      That's awesome to hear bro, thanks so much for your support! I wish you all the best with school! :)

    • @Shinsei.
      @Shinsei. 2 года назад

      buas?

  • @nehemiahkimble1878
    @nehemiahkimble1878 Год назад +30

    If your weapon is a static mesh make sure to set the collision preset to noCollision or else you will experience weird camera behavior. Thanks for the video.

    • @neal-047
      @neal-047 Год назад

      Thankyou ♥

    • @iamDes_
      @iamDes_ Год назад

      Thank you so much for this comment! Took me awhile to figure out why my camera and controls were behaving absolutely bonkers when I picked up an object, you saved me! Setting the mesh to NoCollision did the trick. If you still need the object to have collision when not holding it like I did you can use Matt's Blueprint Interface tutorial to guide you along communicating between blueprints, this allowed me to change the Collision Enabled (or any other variables) in the appropriate meshes when interacting with the object. Great tutorials!

    • @Rehd66
      @Rehd66 Год назад +1

      Woot! You're my hero

    • @Furiac.
      @Furiac. Год назад

      was just about to comment this. it kept launching me into the wall lol

    • @smcfadden1992
      @smcfadden1992 7 месяцев назад

      is this why my character is hopping around ahen i pick it up lol

  • @rocketpoweredchimpgamesphi7798
    @rocketpoweredchimpgamesphi7798 7 месяцев назад +1

    Even as a seasoned programmer (moved over to UE about 6 months back) this tutorial (just doing blueprints in UE for now till I get more familiar with the engine) was AMAZING! The joy of FINALLY having my character holding something lol!

    • @coolorphans
      @coolorphans 4 месяца назад

      Bro I hate blueprints. They take up so much space on the screen. There's such a low density of information. And with programming there's a much higher density of information and you can easily see the execution flow.

    • @rocketpoweredchimpgamesphi7798
      @rocketpoweredchimpgamesphi7798 4 месяца назад +1

      That's fair enough, I have 8 years professionally of C++ (5 as a consultant ) and I still like Blueprints for prototyping, so easy to change stuff around, although I agree the mile wide code can get tiresome! 😅

  • @scarecrowhobo
    @scarecrowhobo 2 года назад +8

    One vital part of the video that would've really helped out before doing all the animation stuffs is putting a download link for the animation and going over how to use that animation for the applied character. I'm spending over an hour just trying to figure out how to import and put an animation before even getting started with the preview animation segment of the tutorial

  • @angeihd
    @angeihd 2 года назад +2

    So I'm a student for a Digital Arts College currently in a Videogame Programming Major and ever since i started taking UE4 classes, i always looked upon you as my guidance, now im in my Capstone project, and this was one of the things the team and i really wanted to do. but we couldn't find tutorials on it that were as cohesive as yours, Thank you lots, Matt. your tutorials are amazing and because of them, its what pushes college students like us forward.

    • @MattAspland
      @MattAspland  2 года назад +1

      That’s amazing to hear! Super happy for you, and glad I could help you all out.
      Wishing you all the best for your project and future endeavours!

  • @BenjaBrenner123
    @BenjaBrenner123 2 года назад +6

    You have no idea how helpful you are, and the fact that it's free! You're doing great things, please keep up these amazingly awesome tutorials!

  • @EliseLuneux
    @EliseLuneux 2 месяца назад

    nice! i was able to attach a static mesh hair with this tutorial

  • @bonobo3748
    @bonobo3748 Год назад

    This has been a helpful video from Matt Aspland. Again.., very helpful video as I have found, but Matt Aspland
    I'm going to watch the whole video. You can choose a different way, but I'm going to be doing it this way

  • @PaladinHD
    @PaladinHD 2 года назад +1

    Always thankful for you and others for making these tutorials for free. Merry Christmas :)

    • @MattAspland
      @MattAspland  2 года назад

      Much appreciated dude, always happy to help Merry Christmas :)

  •  2 года назад +1

    I bought you a monster energy drink at the patreon. I hope you enjoy. :) Keep up the good work, man.

    • @MattAspland
      @MattAspland  2 года назад +1

      Thanks a lot bro! Wishing you all the best :)

  • @artdrawing6682
    @artdrawing6682 2 года назад +2

    Hello sir, you are the best RUclipsr to follow. I work on a game, but I have a problem. I did not know how to make a method of striking for a specific weapon, for example, I also have a stick, an ax, the use of which is different. As you know, I would like to know a method of striking with a stick that is different from the method of striking with an ax. Can you make a video explaining this, I do not think it is It will be difficult for you, sir

  • @nickjohnson7277
    @nickjohnson7277 2 года назад +1

    That's very useful, in many ways. It's similar to how blender's 'Parent & Child' relationship works. Cool

  • @Valeriomerlini
    @Valeriomerlini 2 года назад

    This is the clearest tutorial I've ever seen in my life. Thanks!

  • @AngryPlayerGaming
    @AngryPlayerGaming 2 года назад +1

    I've been waiting for this one, Thanks again Matt, keep up the good work you living legend.

  • @manvendrasingh299
    @manvendrasingh299 2 года назад +1

    I was trying to figure it out few days ago and you made a video on it thanks😁

  • @AngryPlayerGaming
    @AngryPlayerGaming 2 года назад +4

    Video Request: Creating an inventory and equipment slots & Equipping and using items from your inventory

  • @mootzartdev
    @mootzartdev 2 года назад +1

    Pretty amazing! Would be sweet if you could do a full sword weapon playlist/video. Like have it sheathed, unsheathe and then this. Would be great ;)

  • @GameDevOlli3
    @GameDevOlli3 2 года назад

    Video was straight to the point compared to other videos Ive watched, grate vid

  • @beboop3006
    @beboop3006 Год назад

    These videos have been absolutely wonderful. I was wondering if you could do something where you go over making collision for the weapon.

  • @nishantmaggirwar
    @nishantmaggirwar 2 года назад

    Thanks!!! I was looking for this for so long. I'm so glad that I discovered your channel before really starting unreal!!

  • @ElCultodeloDesconocido
    @ElCultodeloDesconocido 2 года назад

    Thanks for all your content, you have helped me a lot.
    Channel members when? I would like to support you a little that way

    • @MattAspland
      @MattAspland  2 года назад +1

      Thanks a lot man, always happy to help!
      And I have a Patreon page set up if that’s good for you? Thanks again! :)
      www.patreon.com/mattaspland

  • @Ivan_Ivailov
    @Ivan_Ivailov Год назад

    Hello, I made this tutorial on UE5 now.
    I didn't see where we put the hitting animation so it can Actually work - Displaying
    the animation when we click left mouse button??... 🙄🤔
    Although, great tutorials! really helps me, I love them! 🤩😁

  • @Gooseguy1000-1
    @Gooseguy1000-1 2 года назад

    This channel deserves way more attention, you're amazing.

  • @cynical9159
    @cynical9159 2 года назад +1

    could you please link a download for the retargeted animations matt? Thank you!

  • @HeyShotgun
    @HeyShotgun 6 месяцев назад

    Could you make a tutorial for picking up a item and that item becomes your follower . That or it’s able to project a ui menu

  • @applejetgg
    @applejetgg 2 года назад +2

    Can u make a video on how to create gravity becoz if i add new pawns or chacrecters they fly in air

    • @MrChick1984
      @MrChick1984 2 года назад

      You have to enable physics simulation for those actors.

  • @backfischinderjemmel7237
    @backfischinderjemmel7237 2 года назад +2

    I started with the FirstPerson Example file, if i follow your excellent Tutorial my weapon ends up spawning not in the Hand of the player and it only rotates when turning, not when looking up an down. In the Preview of positioning the socket everything looks fine

    • @MGScheu
      @MGScheu 2 года назад

      yeah same here

    • @MGScheu
      @MGScheu 2 года назад +2

      Aw I found the solution... turned out I needed to use the FirstPersonMesh not the Mesh (CharacterMesh0) in the BP.

  • @chankulovski
    @chankulovski 2 года назад +1

    Hi Matt, one question . What is the difference between this method of Attaching the Weapon or this one for example :
    In the Character Blueprint we simply add Skeletal Mesh Component, assign the Weapon there, and on the details Panel in the SOCKET section, to assign it there ? Is it the same or something is different ? I hope you will what I'm saying :) thanks man, and keep up your good work .

    • @hocestbellumchannel
      @hocestbellumchannel 2 года назад +1

      That's my own inquiry also.
      I'm actually using the method you describe within the character blueprint. I'm just adding the sword as a static mesh and it works just fine by attaching it to a preexisting socket.
      I don't understand what's the benefit of this process. It would probably be useful to know.
      Having said that, it is just great to have these tutorial videos for free.

    • @bernardobe3580
      @bernardobe3580 Год назад

      @@hocestbellumchannel This allows you to make a pick up system, Matt made another tutorial that depends on this.

  • @dreamcreateinspire
    @dreamcreateinspire Год назад +1

    for some reason its only attaching once. but then when i drop it i cant re pick it up! any suggestions?? thanks love the tuts

  • @dingbat466
    @dingbat466 2 года назад +1

    where's the retargeted animations? I'm having trouble getting the animations, could you please link it?

  • @palanezeur7755
    @palanezeur7755 2 года назад

    BIG THANK !!!!!!!!!!!!! man

  • @israeloconnor7381
    @israeloconnor7381 2 года назад

    Oh my gosh lol I literally about to make a game with this

  • @poublo
    @poublo Год назад

    Boss I follow every video you put out keep up the good work. Question, I followed all steps on attachment, the gun snapped to the character but it's still stiff why my character moves?? Any suggestion

    • @poublo
      @poublo Год назад

      What I mean by the snap part is, I placed the gun in the static mesh and had to position it in there ( cause it was on yhe ground when you hut play and would move with the character across the ground) so I position it in the static mesh to where it look like it's near my hand. On the 3rd person Skelton attachment I made weapon under the (r) hand and did all the steps with the correct name. The gun mesh would animate right when I preview but when I play it won't connect to my character....... Now I do want to mention my character is a MetaHuman attached character to the skin of the 3rd person.( I'm not sure if that's causing the problem

  • @jacobkendrick6938
    @jacobkendrick6938 2 года назад

    Hello!!! You explained how to create a socket to attach a weapon to the character’s hand. I was wondering if you could explain (or possibly make a video on) how to grab things from the floor in third person with it attached to the hand. Also, how can the item be released. Thank you!!!

    • @flyingmalkie4346
      @flyingmalkie4346 2 года назад

      Not an expert but look up physical animations, used in things like climbing sytems, you give a place for your character to grab, it will generate the animation to reach toward it. Then maybe an anim notifier or something when you make contact with the item, or after a second delay giving time to reach toward it, then regular attach system like in the video. Ive never used or tried any of this but worth a look.

  • @ARKTIKWORM
    @ARKTIKWORM 2 года назад

    Could you create a tutorial on how to retartget animations from mixamo to the ue4 skeleton?

  • @xDoMeRaSx
    @xDoMeRaSx 2 года назад

    Did they removed the animations from the asset? Many people including me cant find the animations after importing the asset.

  • @Bookofwords
    @Bookofwords 2 года назад +1

    So, I go to try and preview with specific animations, however the ones I have do not show up, only the normal animations that UE gives you, so I cant preview it...and by extention, I'd assume I wont be able to use it later down the line either
    If anyone knows how to fix this, please let me know...

  • @MrChick1984
    @MrChick1984 2 года назад +1

    What if you have many weapons of different sizes and not all of them match the socket position? Is there any better way than keeping "socket offset" for every weapon, so when you spawn it, you can move it to right position? I would also keep scale multiplier or something like that, could be useful when you have characters with different sizes to scale the weapon accordingly.

    • @MattAspland
      @MattAspland  2 года назад +3

      Great point yeah, I imagine you'd probably want to do more fine tuning of the positions of the weapons inside of their respective blueprints. So you could have two guns in different positions in their blueprints, so that they can be placed in the same socket position. Hope that makes sense!

    • @AngryPlayerGaming
      @AngryPlayerGaming 2 года назад

      I'm still new to this and might not have any idea what im talking about but 5:47 looks like the white ball is where the socket would be so if you have different weapons you would just move the mesh so the socket position is where you want instead of moving the socket in the hand

  • @baryafe
    @baryafe 7 месяцев назад

    can you import a blueprint instead of mesh? i have a torch with fire particles, can i import that? 5:38

  • @tevildo9383
    @tevildo9383 2 года назад +3

    So I followed this, but I used a very rudimentary, custom “sword” object that I created in blender, and it works fine (I have a “sword” in my mannequin’s hand) but there’s definitely something wrong. I feel like it has something to do with the collision on the “sword” because when I try to walk, I get really glitchy skippy movements as if I’m being repelled away from the direction of the hand my “sword” is in. I know it’s due to the sword because if I break the blueprint wires to stop the sword from spawning, then I can move normally.
    I know my static sword mesh has collision, but I never did anything to create that (I literally just imported the .fbx and then went straight to the blueprint portion of this video because the mannequin in UE5 has a “weapon_r” socket by default).
    Any help would be greatly appreciated because if I’m going to start work on a hack n slash project (and make my own weapons from scratch), I kind of need a sword that doesn’t teleport my character 10 feet to the left when I try to walk forward.

    • @tevildo9383
      @tevildo9383 2 года назад +4

      Fixed it for now (I have no clue if this will cause problems in the future, I need to figure out some tests to run). Basically in the BP for my sword (where the mesh and actor are) I just disabled the mesh collision (Collision Presets set to NoCollision).

    • @jonweaver2696
      @jonweaver2696 2 года назад +1

      @@tevildo9383 You absolute legend, I had the same problem and your solution worked for me as well, must be some weird interaction between them "bumping" into each other, well done!

    • @savannahcatherall2834
      @savannahcatherall2834 2 года назад

      Omg, thank you. I;'ve been fiddling with my collision for hours and this saved my life and my mascara. Lmao

    • @aayush7541
      @aayush7541 Год назад

      tysm this works

  • @leatherneckgaming8191
    @leatherneckgaming8191 4 месяца назад

    So I am using the enhanced input system and when I connect this to the sequence for some reason it messes up my players movement. Any Idea what could be causing it?

  • @Preirin
    @Preirin Год назад

    Matt, quick question. Is there a way to close the character's fist over the weapon? I have done so in the skeleton, but it doesn't seem to xfer to the UE4 Manny.

  • @Cain532.
    @Cain532. Год назад

    I made a ragdoll weapon pickup, but the object is T posing in the player hand socket. Is there a way to make it ragdoll while in the players hand?

  • @NyTE-y6t
    @NyTE-y6t 10 месяцев назад

    where do i get the sword and sheild slash aniamtion pack

  • @elden4267
    @elden4267 Год назад

    hi is there any way to use 2 soket because I have a assault gun and my left hand don't stick to the barel

  • @sonny5974
    @sonny5974 2 года назад

    my weapon's origin point is on the blade tip.. How can we change it to be on the sword handle ?

  • @RozvozceTofu
    @RozvozceTofu Год назад

    i got left and right hand snapped to my body, but how i can turn it off while reloading? is there any way?

  • @boristrendafilov2243
    @boristrendafilov2243 Год назад

    and what if i want to have many different weapons sword axe spear etc do i have to rotate and scale every weapon like that to fit in the socket ?

  • @crackedeggstudios
    @crackedeggstudios Год назад

    How do you prevent the weapon from clipping through the character on certain animations? I considered updating the rotation on overlap, but for some reason it seems like this event never fires while it's socketed.

  • @phantomgaming5199
    @phantomgaming5199 Год назад

    if we use live retargeting on metahumans, then weapons get attached to the source skeletal mesh, any idea how we can attach to metahuman instead, btw im using Flexible combat system with metahuman

  • @ayyykriz
    @ayyykriz 2 года назад

    What if I have two swords that are a static mesh? Specifically twinblades

  • @shawns9902
    @shawns9902 2 месяца назад

    What if your weapon doesn't show up in the mesh dropdown?

  • @galberger3937
    @galberger3937 Год назад

    Hi.
    At 3:09 you use a sword attack animation.
    How to get it?

  • @emberknight6848
    @emberknight6848 2 года назад

    will i be able to make a pickup system for this?

  • @RDD87z
    @RDD87z 2 года назад

    if i want to make animations based on this ue4 mannequin , its better to make a new bone for the weapon right?

  • @mistermakebelieve
    @mistermakebelieve 2 года назад

    I'm using UE5 and the sword doesn't show up as a skeletal mesh. Any idea why? I added it to my project. I can view the mesh in my browser and tried using 'Use Selected Asset from Content Browser' with the SK_Blade_BlackKnight selected. I could select SM_Blunt_BoneShardMace but not that specific sword.

  • @lolaswift111
    @lolaswift111 Год назад

    hi matt, what if the weapon is a seperate blueprint? thx

  • @johnsemeraro6160
    @johnsemeraro6160 Год назад

    Does this still work in 5.2? Instead of it spawning in the position I set it in the socket it spawns between my player's legs.

  • @LingoMan
    @LingoMan 2 года назад

    nice bro nice ❤️

  • @habibismassacre
    @habibismassacre Год назад

    Im using UE5 and its not playing the animation whenever I click my mouse? is there something I missed or need to do because I set the animation it just doesnt trigger after clicking?

  • @TommyS04
    @TommyS04 2 года назад

    How to attach a 2 handed weapon to the character? with my animations its attached to the right hand, which moves correctly with the sword but the left hand is slightly of the sword, how to fix that?

  • @Fabi_1987
    @Fabi_1987 Год назад

    I have the same problem with this code as with your code for pick up and drop item.....without the item in my hand everything ist normal but when i got the item my character is always walking sideways. While crouching it is working ...i really don´t know what the f... is going on

  • @kio9906
    @kio9906 2 года назад

    So if I was doin' sword and gun how would I added both ?

  • @AA-du6hb
    @AA-du6hb 2 года назад

    after i attach the sword to actor, the character movement changes when i play. it is moving sidewards. how to fix

  • @jfierro1394
    @jfierro1394 Год назад

    will this work for first person as well?

  • @iitzraidersz4529
    @iitzraidersz4529 2 года назад

    I click a button to equip my certain weapon (instead of event begin play) and it doesnt replicate towards other clients, can you help me with this problem?

  •  2 года назад

    And how would you go about simply throwing the object and then picking it up on the ground? sticking to the socket again?

    • @orlandorodriguez6236
      @orlandorodriguez6236 2 года назад

      Yup. You can also hide the sword and spawn a new mesh on the ground. That way if the player triggers with the collision of that sword you can pick it up again. That way you reenable the sword. There are a lot of ways to do it. You can also do it with line tracing.

    • @MattAspland
      @MattAspland  2 года назад +2

      You can attach and detach from sockets using nodes in this video whenever you need to :)

  • @maxim9852
    @maxim9852 2 года назад

    How do I attach f.e. a camcorder that´s already attached to the players hand to his head when equipping it with the hand still on the camcorder? Do I have to animate all animations new like walking, sprinting etc. or is there a better way?

    • @maxim9852
      @maxim9852 2 года назад

      I try to implement a feature similar to outlast with the camcorder (for better understanding)

    • @MattAspland
      @MattAspland  2 года назад

      I imagine the easiest way will be to probably use separate animations for this, and maybe even have a widget come up on screen when you want to look through the camcorder. Physical animations might also be something good to look into

  • @xFadesaway
    @xFadesaway Год назад

    I have no idea why but when I try using the swords from that same pack the swords are gigantic and no matter how i try to shrink them they dont fit :c

  • @thatchyhurdle4271
    @thatchyhurdle4271 2 года назад

    I've got everything working but how can i now do the animation ?

  • @smcfadden1992
    @smcfadden1992 7 месяцев назад

    it wont let me move the preview asset

    • @smcfadden1992
      @smcfadden1992 7 месяцев назад

      ok i see now hes not moving the weapon, but is there a way to not move the socket? if you want multiple different weapons?

  • @gavinanderson8870
    @gavinanderson8870 2 года назад

    um wheres the download anim?

  • @RP-dy5mu
    @RP-dy5mu 2 года назад

    Can someone help me understand the benefits of doing it this way? I'm failing to see why unreal does it like this. It seems like a really long way of doing something simple. I come from unity and there we can simply edit the skeleton itself and attach it there (basically we can stop after the previewing section). This also means you aren't *forced* to spend resources spawning assets which can be nice depending on what game you have (like if you know you won't mix weapons for different character types).

  • @vilingua
    @vilingua Год назад

    My item went UUUUUUPPPP to the space when I picked it up XDDDDDDDDDDDDDDDDDD

  • @MaxStudioCG2023
    @MaxStudioCG2023 2 года назад

    WHY NOBODY MAKE THIS WITH A UE5 CHARACTER OR WITH A METAHUMAN

  • @peter486
    @peter486 2 года назад

    i think you are lying.. the sword is there i can clearly see it :)

  • @РУССКИЙ_СОЛДАТ
    @РУССКИЙ_СОЛДАТ 2 года назад

    And later: ...Detach...Destroy...
    ( The eternal problems of the engine... 😑)

  • @Rehd66
    @Rehd66 Год назад

    Thank you.
    I have a problem. Everything worked as far as attaching the weapon, but somehow once I spawn it and try to move, something is pushing me backwards off of my floor
    Edit: Never mind. @Nehemiah Kimble is a saviour