• We are looking for a content creator to help market our assets and a future unannounced project. More details are on this page.

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.
 

beak

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

beak

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

Justin

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

beak

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

beak

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

Justin

Administrator
Staff member
Without breakpoints/log statements it makes it really hard to debug. At what point does the ShootableWeapon stop firing when it is shot?
 

beak

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