Results 1 to 14 of 14

Thread: Melee Weapons

  1. #1
    MSgt. Shooter Person
    Join Date
    Aug 2011
    Location
    Utah, USA
    Posts
    44

    Default Melee Weapons

    I've written a three part tutorial that shows one way to create your own melee weapon system for the UDK:

    http://www.mavrikgames.com/tutorials/melee-weapons

    It also covers in some detail:

    • Third person isometric cameras
    • Archetypes
    • General weapon functionality
    • AnimSets and AnimTrees
    • Particle effects
    • Sound Effects

    It was tough for me to find any documentation for melee weapons, so hopefully it's helpful for everyone else!

  2. #2

    Default

    Awesome, I just glanced at this but I will definitely be reading it for my next project. Thanks!

  3. #3
    MSgt. Shooter Person
    Join Date
    Mar 2012
    Posts
    57

    Default

    Thank you for the tutorial.

  4. #4

    Default

    Thanks a lot

  5. #5
    MSgt. Shooter Person
    Join Date
    Jul 2011
    Location
    Germany
    Posts
    186

    Default

    Nice. Well done.
    A nice basic setup!
    My Tutorials and Threads:
    Kismet Timer Tutorial: Here
    Borderlands Teleport Tunnel Effect: Here

    ~Scrapland~

  6. #6
    Redeemer
    Join Date
    Nov 2009
    Location
    Crete
    Posts
    1,044

    Default

    Very handy,thanks for this!

  7. #7

    Default

    Thanks for sharing.

  8. #8
    Redeemer
    Join Date
    Nov 2009
    Location
    Crete
    Posts
    1,044

    Default

    A minor mystake I noticed...

    In the pawn code where you type

    var AnimNodePlayCustomAnim SwingAnim;
    ...

    simulated event PostInitAnimTree(SkeletalMeshComponent SkelComp)
    {
    super.PostInitAnimTree(SkelComp);

    if (SkelComp == Mesh)
    {
    SwingAnim = AnimNodePlayCustomAnim(Mesh.FindAnimNode('SwingCus tomAnim'));
    }
    }

    It's not mesh.findanimnode but:

    SwingAnim = AnimNodePlayCustomAnim(SkelComp.FindAnimNode('SwingCustomAnim'));
    Last edited by ThePriest909; 05-29-2012 at 08:41 AM.

  9. #9
    MSgt. Shooter Person
    Join Date
    Aug 2011
    Location
    Utah, USA
    Posts
    44

    Default

    Quote Originally Posted by ThePriest909 View Post
    A minor mystake I noticed...
    ...
    It's not mesh.findanimnode but:

    SwingAnim = AnimNodePlayCustomAnim(SkelComp.FindAnimNode('SwingCustomAnim'));
    Good eye Priest, it's been updated. Obviously the code worked since they are equal, but as a matter of clean code, it is a good idea to use the parameter and not the property in this case. Thanks for the heads up!

  10. #10
    Redeemer
    Join Date
    Nov 2009
    Location
    Crete
    Posts
    1,044

    Default

    Actually it didn't. I thought it would since they are meant to be equal but It was trying to find the anifnotify in the meshcomponent class.

  11. #11
    MSgt. Shooter Person
    Join Date
    Mar 2012
    Location
    USA, IL
    Posts
    55

    Default

    Great tutorial, I actually found this while google searching for UDK melee weapon tutorials and I saw your thread and just had to comment, great tutorial.

  12. #12
    MSgt. Shooter Person
    Join Date
    Aug 2011
    Location
    Utah, USA
    Posts
    44

    Default

    Quote Originally Posted by ThePriest909 View Post
    Actually it didn't. I thought it would since they are meant to be equal but It was trying to find the anifnotify in the meshcomponent class.
    "Mesh" is actually a SkeletalMeshComponent, which does in fact extend MeshComponent, but it's declared around line 230 (in the May 2012 version of the UDK) in the Pawn.uc class as a SkeletalMeshComponent. It's also the very same object that gets passed into the function. Just to be sure, I put a breakpoint in that function in Visual Studio and examined both objects. They were both "SkeletalMeshComponent_0" - the same object. If they weren't the same object, the function wouldn't get past the "if (SkelComp == Mesh)" line. Out of the box, it did work like it was (several people have emailed me and it has worked for them as well), but it definitely wasn't well structured code. If it wasn't working for you, Priest, then I would guess that there was some other factor that was throwing things off. In any case, I'm glad you caught it so I could clean it up.
    Last edited by mavrik73; 05-29-2012 at 06:15 PM. Reason: Adding a quote from ThePriest909

  13. #13
    Redeemer
    Join Date
    Nov 2009
    Location
    Crete
    Posts
    1,044

    Default

    Quote Originally Posted by mavrik73 View Post
    "Mesh" is actually a SkeletalMeshComponent, which does in fact extend MeshComponent, but it's declared around line 230 (in the May 2012 version of the UDK) in the Pawn.uc class as a SkeletalMeshComponent. It's also the very same object that gets passed into the function. Just to be sure, I put a breakpoint in that function in Visual Studio and examined both objects. They were both "SkeletalMeshComponent_0" - the same object. If they weren't the same object, the function wouldn't get past the "if (SkelComp == Mesh)" line. Out of the box, it did work like it was (several people have emailed me and it has worked for them as well), but it definitely wasn't well structured code. If it wasn't working for you, Priest, then I would guess that there was some other factor that was throwing things off. In any case, I'm glad you caught it so I could clean it up.
    A UDK version incompatibility then I guess? :\
    I don't know but as soon as I replaced the line the code compiled. Minor thing in any case.

    Anyway, do you think we could move the handle animation part of the code inside the weapon class all together and control the anim tree from there? I tried it but I couldn't get it to play the anims at all :\
    In my case, I work on a 1stperson melee weapon and I made the arms sk part of the weapon itself.

  14. #14
    MSgt. Shooter Person
    Join Date
    Aug 2011
    Location
    Utah, USA
    Posts
    44

    Default

    Quote Originally Posted by ThePriest909 View Post
    Anyway, do you think we could move the handle animation part of the code inside the weapon class all together and control the anim tree from there? I tried it but I couldn't get it to play the anims at all :\
    Could you be more specific? Which part of the code do you mean? As it is now, the animation is handled from within the weapon class during the "FireAmmunition" function. The only part handled in the pawn is actually getting the AnimNode from the pawn's skeletal mesh. If your animation is actually on the weapon, you have to set up an AnimTree for the weapon and pull the AnimNode from there.

    Knowing that your pawn is set up for first person actually sheds a little light on what we've been talking about also. The tutorial is set up to handle third person pawns that have a full body mesh. I honestly can't say how a first person mesh is handled, though I think it should work if everything's set up correctly.


 

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Copyright ©2009-2011 Epic Games, Inc. All Rights Reserved.
Digital Point modules: Sphinx-based search vBulletin skin by CompletevB.com.