Download

Problem replicating collisions

I am making an FPS game and was trying to get multiplayer working. I fire I physical projectile which the player detects if certain hit boxes around the body are hit by the projectile.

My problem is that I am using an “On component begin overlap (Chest)” node and it should detect the projectile hitting it, then remove the health of the player that got hit. Instead, it removes the health of the player that fired it.

I have made sure that when the projectile is fired, it does not hit any of the player firing it’s collision boxes.

Any help?

I think you need to include a screenshot of what your overlap and how you remove the health so people can help you out. If its removing the health of the player that fired it then it just sounds like you’re using the wrong reference

In my first person character there there are 16 collision boxes all around different parts of the character. Using the node “On Component Begin Overlap (Chest)” i then connect it to a macro called “Take damage” with the inputs of exec, object and damage multiplier (so that different parts of the body take different damage). Inside the macro I have a sequence with each three of my projectiles connected up to it. The wildcard is the object input then out of each “Cast To Weapon1Projectile” (the number is different for each projectile) I have a “Set Health” to be “Get Health” - (“Get damage” (This is from the casted projectile) X “Damage Multiplier” (from the input)). Then all of the outputs are connected up to the singular exec output of the macro.
I have tried making a custom event connecting up to the macro so that I could try different replications but none of them seemed to have worked.
You may be wondering why I didn’t just send a screenshot and that is because my pc is having a windows update at the moment.
thanks for the help.

That’s extremely overcomplicated. You don’t need those additive collisions. Open the physics asset of the character and you should have collision primitives per bone already. View the Skeleton tree.

In the projectile class create an On Blocking hit event for the projectile collision. On hit break the result and get the Bone Name. Use a Switch ( on name ) for the flow to calc proper dmg.

An alternative to the lengthy bone based switch would be to assign a phys material to each bone in the physics asset class. Then have a smaller switch (head, neck, chest, torso, pelvis, arm, leg)

e.g. create a simple phy material named PhysMat_Arm. Assign that material to each capsule/box in each arm (upperarm_l Capsule 0, lowerarm_l Capsule 0 etc).

Any hit from clavicle to finger would be a arm hit. Do this for legs, chest, torso (stomach), pelvis, neck and head.

On hit, break result -> get phys mat -> switch