's Melee Weapon Plugin, Custom C++ PhysX Coding For You! ♥

Melee Plugin Update for 4.12 - 4.14 ~ Bug Fix

Dear Community,

I’ve fixed a bug in the Melee plugin where if you did not set a skeletal mesh prior to game start, or changed it to a completely different physics setup during runtime, the component would not trace correctly.

Now you can call SetSkeletalMesh anytime during runtime and I fully update the inner workings of the Melee Weapon.

In C++ see RamaMeleeWeapon::UpdateSwingPoseBodies(); in my latest update!

Enjoy!

:heart:

  • Just bought your plugin - it is working great! Very easy to use. I had implemented a similar system using just traces from the tip/base of the weapon in the past, but this time around I decided to just use your plugin. Very happy so far…

But now that I am getting accurate bone/weapon collisions… my issue is getting the actual weapon animation to hit the target.

e.g. The arc of my sword swing may be too high or too low depending on the target mesh and character positions involved.

Do you have any thoughts on this - should I use some kind of IK to adjust the swing at runtime? Perhaps the builtin 2-Bone IK node or maybe something like Ikinema?

Basically, I want to adjust the swing to aim at a hitbox or bone on the targetmesh.

Thanks for any thoughts/advice

Hey - Also - a feature request…

When the weapon makes contact, it would be very helpful to get the normal of the swing arc - this is different than the hit normal.

eg when hitting a wall, the hit normal is always perpendicular to the wall. But early in the swing the arc normal points more forward, whereas at the midpoint the arc normal points points perpendicular to the forward vector.

Ideally, the force to be applied at the contact point is not the hit normal, but rather the swing normal at the point of impact.

Thanks again

Update - For those interested, it is easy to calculate the swing arc normal:

  1. Add a socket to the tip of all weapon skeletons
  2. Each frame, the swing arc normal is just the difference between the current tip location and the previous tip location (normalized)
  3. Store current tip location as last tip location.

I have found the swing arc normal to be much more useful than the impact normal, which is just the normal of the surface at the impact point

I am happy you found a solution you like!

I recommend Fabrik (Anim BP node) , or you can use a Blend Space! Then you can do a angle check to target’s body center or target body region and pass that angle into your aim offsets and trigger the body to adjust in a nice way, such is the topic of basic Procedural Animation concepts

Abatron - the making of a UE4 Hybrid game =) - Game Development - Epic Developer Community Forums)&p=160100&viewfull=1#post160100
https://youtube.com/watch?v=ApvYCqSuHTc
https://youtube.com/watch?v=ApvYCqSuHTc

:heart:

That is a great point and a great request!

I’ve added it to my to-do list :slight_smile:

And you’re welcome!

Thanks for stopping by!

:heart:

could you please do a quick tutorial on setting this up on pre-existing projects using class BP for multiple weapon types?

I fully understood the example video to set this up for one weapon, bound to the character, but that isn’t a very likely situation for a multiplayer game.

Any help would be very much appreciated!

I expected more colors in it.

Cool, useful stuff as always ! Keep it up!

In a recent patch you can simply use SetSkeletalMesh to change the weapon out for others, and you can associate a set of damaging shape info with each skeletal mesh, it’s pretty simple any issues let me know :slight_smile:

Hee hee! Nice to hear from you @Neongho !

Hey there @HaxO ! Thanks for the compliments! Have fun today!

:heart:

Full Sample Project

In a recent post I’ve submitted a full 4.17 project you can use if you have my plugin already:

Market Place Link
https://www.unrealengine.com/marketp…-weapon-plugin

Direct Link:
http://www.lightningfitness.org/ue4c…tDemo_4_17.zip

Enjoy!

I’, trying to figure out how to switch weapons for VR Player. I understand how to setup a character with melee weapon predefined but how do you swap melee weapons Mesh and DamageMap at runtime. The DamageMap struct can’t be broken apart in Blueprint can this only be done through C++ code? It blueprint how?

What I need is a SkeletalMeshActor but a RamaMeleeWeaponMeshActor. Is there a way to get SkeletalMeshActor to contain a RamaMeleeWeapon for the Mesh Component?

RamaMeleeWeapon is to slow to detect fast movement by VR Player holding a RamaMeleeWeapon. Collision events from what I can tell are lost. Tick rate is too low to keep up with VR Player. Any ideas how to fix this?

Actually figured out turning the swing on and off caused most of the gaps I was seeing. To make it work, you need to have swing on when in VR Players hand and do other logic to handle the multiple hit events. I could not find any other way to get close to accurate hits.

, are you able to handle Convex collision. Can’t seem to mark them as doing damage.

VR

Regarding VR: Yes you just have to continuously trace for the period of time when the user’s weapon is able to do damage, because you don’t have pre-created animations like in case of a non-VR game.

I chose not to support convex for now for optimization reasons, I think it is far more efficient if you use simpler shapes. If you find you cannot approximate accurately enough with capsules, boxes, and spheres, I can reconsider this stance.

Have fun making your game!

:slight_smile:

PS: Thank you for nice comment and the update in the marketplace comments section about these matters :slight_smile:

, what i did to make items act more real is to setup two skeletal meshes with their own physics asset. One is the parent of the other. The physical asset in the world is a standard Skeletal Mesh which full convex hull collision but basic shapes to give realistic physics when item is thrown or dropped, … The second skeletal mesh is a weapon which is hidden in game but setup with the simple collision shapes (parented to the visual representation of the weapon) [Its the same skeletal mesh but a different physics asset]. This provides the on hit events. Thought this would be useful for other to know.

And How? can u show a example? Thanks

Did you ever figure out how to update the DamageMap (and uupdate the active arrays) when you change a mesh (For using multiple weapons on one component)?

The DamageMap is something you can read/write in BP. You could simply store variables of FRamaMeleeDamageMap, one for each of your weapons, figure out your desired settings, and then load that map when you use SetSkeletalMesh to change your weapon.

More advanced: you could make a struct that has a weapon mesh as a variable, and also a FRamaMeleeDamageMap, then make an array of this struct. Now you can look up maps by the asset and retrieve the desired DamageMap.

**Even More Avanced: **You could use a Map (instead of an array), using the skeletal mesh asset as the key, and the FRamaMeleeDamageMap as the value, and store this map somewhere convenient, possibly your character BP itself.

:heart:

Hi ,

Great plugin! Works really well. However, I would like to port my game to Mac and I’m not sure how to do this or if it is even possible. I saw a hint in the marketplace comments that it might. My project is Blueprint only right now. So, is this possible? If so, how might I go about this? Can I compile your plugin with Xcode and drop it into the third party plugin folder? Do I need to compile my entire project and then re-compile with Xcode? I have messed around with C++ implementation before but I am a noob(to C++). Any assistance would be greatly appreciated.

Thanks!
LordPomp