playMaker

Author Topic: How to sync weapons with Pun2?  (Read 1143 times)

paradiseprime

  • Full Member
  • ***
  • Posts: 106
How to sync weapons with Pun2?
« on: November 09, 2021, 11:23:51 PM »
I figured out how to spawn projectiles but now I am having trouble syncing weapons. I tried Pun Instantiate + Parent but that didnt work. Wouldnt the easiest way be to give it a Photon View and sync the transforms?


The current method I am trying is having all equippable weapons already attached to the player but deactivated and having Photon Transform Views on them. Their position changes but it is not consistent.
« Last Edit: November 10, 2021, 03:44:07 AM by paradiseprime »

justifun

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 285
Re: How to sync weapons with Pun2?
« Reply #1 on: November 10, 2021, 12:55:06 PM »
When you instantiate the bullet with a photon view (on your master client) , it will create the object on all of the clients machines.  Then you can assign the bullet a variable with the owner of the player on each machine so you can later check who's bullet hit who etc.

paradiseprime

  • Full Member
  • ***
  • Posts: 106
Re: How to sync weapons with Pun2?
« Reply #2 on: November 10, 2021, 02:09:12 PM »
I think you misunderstood what I am trying to do.

I am trying to equip a weapon to a player and have that weapon be synced for every other player. Currently the weapon is summoned and other player can see it but it does not move when attacking.

When I tried Pun Instantiate on the weapons, they did spawn but they always spawned at 0,0,0 for other players and still didnt move.