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.
 

Justin

Administrator
Staff member
Can you tell me how to reproduce what you are seeing within the demo scene? I'm not completely following.
 

beak

New member
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
 

beak

New member
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.
 

Justin

Administrator
Staff member
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.
 

beak

New member
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.
 

Justin

Administrator
Staff member
You can step through ShootableWeapon.HitscanFire/ProjectileFile to determine that object that was hit.
 

beak

New member
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
 

beak

New member
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
 

Justin

Administrator
Staff member
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.
 
Top