PUN Player Hitbox Troubles

beak

New member
Hey all,

I have been having a strange issue after creating a shootable weapon for my multiplayer game.
I can shoot and thats all good, but hitting other players there seems to be some capsule collider around them that blocks the bullets.

There is a chance to hit them if shooting in certain spots, I have managed to hit people semi-consistently when shooting at the hands of the other player if they are holding a gun. Its very strange.

Hope someone can help me :)

Thanks,

- beak.
 
Can you tell me how to reproduce what you are seeing within the demo scene? I'm not completely following.
 
I have just followed the tutorials to setup a scene, character and all that for PUN, and created a runtime pickup pistol to be used by the players.

I haven't really fiddled with anything outside of what the tutorials explain as I have had this problem.

I cant upload a screenshot if it helps
 
I'm unsure how you mean to reproduce it in the demo scene sorry.

I might be able to explain it better, the impacts seem to be hitting the player capsule, it just doesn't seem to be actually registering a hit on the other player. It only sometimes happens when shooting at like the hands and some other random spots, its hard to reproduce consistently.
 
One way to debug this is to place a log within the OnDamage method of the PunHealthMonitor.OnDamage and see what is being damaged. You can then insert a breakpoint and follow the RPC to ensure the correct object is being hit.
 
Is there a way for me to do the complete opposite of that, and log what object has been shot rather than what has taken damage. As the issue is I am not hitting the other player, its hitting something else.
 
You can step through ShootableWeapon.HitscanFire/ProjectileFile to determine that object that was hit.
 
Is there a way for me to use the On Hitscan Impact Event to get the impacted object rather than stepping through the script with breakpoints?

I would rather have it log to the console the name of what I am hitting for future debugging
 
I managed to get a debug log in of the shot object, it seems to be hitting the capsule collider, but it seems inconsistent as to whether it actually does damage or not, since the shots that do damage are still hitting the capsule collider
 
If the hitscan hit the capsule collider then that is good. You should follow it to the client to ensure the health attribute from the correct health component is selected.
 
Apologies for the extremely late reply, been very busy with other things. Been about two months since this thread and I have on and off a few times had a chance to try to look into this in my spare time, and I still have not found a cause for this bug. Any ideas?
 
I have tried doing this in the past, I am going to try again now. What should I particularly be looking out for, both what it should be hitting or something it shouldnt be hitting?
 
In the end Health.Damage should be called. You can start within the ShootableWeapon and trace it from there. I would use a hitscan first as that will be easier to debug.
 
Having trouble getting breakpoints in as there are namespace missing errors all through for some reason.

One thing I have noticed doing some testing today, I seem to only see, hear and hear other players gunshots when they actually hit me. When they shoot me, and it doesnt damage me, I dont get the sound or muzzle flash for them.
 
I have also done a test with the pistol and one other person.

The top line is me going along, shooting each square in a row until I run out of bullets, 12 shots.
I got the person connected to do the same thing, starting at the same position, just one row below.

Not every shot came through that they did, and they shot the same amount as me.

This is my view of the test
image_2021-11-16_223632.png

This is their view of the test.
mmmeee.png

I also got them to shoot at every square inside this screenshot, and these are the only ones that came through.
shots.png

I am not sure what is going on here, any ideas?
 
Without breakpoints/log statements it makes it really hard to debug. At what point does the ShootableWeapon stop firing when it is shot?
 
The client can shoot all of their shots fine, and they see all of their own, its as if the other players shots are not all being received.
 
Top