Okay, so I’ve got my actors working and I can shoot other characters in my multiplayer game while running several instances of my game.
Taking damage works just fine - shooting works fine though there is a slight delay between projectile hitting the target and destroying itself.
However, it’s clear that the projectile is generating the hit event and stopping based on the capsule component and not the static mesh of the char.
I read that I can break hit results to get things like which bone was hit I.E. headshot does more damage.
Currently I do not know how to get around the capsule component to actually determine which body part or bone was hit - and If I were to do that I am assuming if the character was running toward me then I might generate multiple hit events in between the first one being called and the actor being destroyed.
I also have an issue with characters who fire a projectile can also be damaged by them - I don’t want to change it with an offset for this situation, I’d rather it just be able to collide and not do damage to it’s owner.
If anyone can provide me some direction on this - I’d be very grateful. I did find one other topic that was marked as answered for the capsule portion of my question - however the answer was unclear to me as it was just in text and I failed to completely comprehend it.
Thank you all for any help - and your time in reading this.
So what you probably want is your projectiles to ignore collision with the capsule and block when they touch your player mesh. I’m not sure if this is the best way to do it but what I usually do is create my custom object collision channel, this way you can tell you projectiles to not hit the capsule which is probably in the pawn type channel and just hit your custom channel which you can name playerMesh or whatever.
In this question I give a quick explanation on how to create a custom collision channel:
Hope this helps you
!
1 Like
That is something I didn’t know existed so thanks! That should definitely help with the problem of getting around the capsule.
Do you have a solution for say - having a really slow projectile in relation to character movement speed - so that I can’t shoot myself.
I’m not sure in this channel system you’ve shown me if it is possible to single out the projectiles “owner” and make him not collide.
Or use Tags like unity had UE4 has them hidden in the setting for each actor… but the channel works just as good… some bugs in settings so make sure you export your channels when your done. =)
Ok if you want that, there should be various ways to achieve it. Here’s what I can get off the top of my head right now. You are using an overlap event right? When you spawn a bullet, each of them could have a reference to the player that spawned them, now when the bullet hits a player mesh you would get the hit result, then you would break it and get the hit component and you would compare it with the skeletal mesh component of your player reference, if they are not the same, then you execute whatever code you have to.
Collision channels are usually sufficient, but if the shooter and the target are both on the same collision channel then the projectile could collide with the person/weapon that fired it. To avoid something like this, you can try using the “Ignore Actor When Moving” node. I’ve done this in C++ and it works but I haven’t tried it in blueprints. Just call that, once with the character and once with the weapon (if necessary). Note you can also turn the ignore off, so if you want it to be able to hit its owner but still fire properly then you can call that node again after a given distance/delay.
Ignore Actor When Moving
There is also a system that lets you ignore actors by flag but I’ve never been able to get that to work.