The Photon Forum
is Closed Permanently.

After many dedicated years of service, we have made the decision to retire our Forum and switch to read-only: we´ve saved the best to last! Your search result can be found below. Plus, we offer support via these channels:

Try Our
Documentation

Please check if you can find an answer in our extensive documentation on PUN.

Join Us
on Discord

Meet and talk to our staff and the entire Photon-Community via Discord.

Read More on
Stack Overflow

Find more information on Stack Overflow (for Circle members only).

Write Us
an E-Mail

Feel free to send your question directly to our developers.

What's the best way to check if a projectile has hit another player?

Yoshihide
2022-03-13 00:38:33

Hey,

Currently, players can shoot projectiles that check via Raycast if they have hit a player. If the projectile has hit a player, the player is respawned. These bullets are synced on each client using PhotonNetwork.Time.

The Raycast detection is handled on the client that shot, however this can lead to cases when you dodge a hit but end up dying anyway, as your player was slightly behind on the other player's screen. I have tried setting the master client to detect bullet hits, but this unfortunately leads to a slight but noticeable delay when your bullets hit another player.

Any ideas on how I can mitigate this?

Comments

Tobias
2022-03-15 11:44:36

This approach favors the shooter and it's a common problem in shooters. I don't think it can be fully resolved. The way you do it, sounds basically correct.

If you aim for more precision, I'd recommend switching over to Fusion. It's a bit more tricky in the beginning but it won't get you stuck without a proper timing basis. Fusion is tick based, has hitbox recording and is generally built from the ground up with competitive shooters in mind. It uses a higher update rate and you should be able to minimize unfair situations with it.

Back to top