How to handle weapon object parented to character hand

Options
Hi,
i am currently implementing a VR FPS where players can put their weapons to different slots on their body (also their hands obviously) or also may drop their weapon to the floor or pick up weapons from the ground.

The question i have is how to handle these weapon objects most efficiently in terms of network ressources / use of photonviews / messages being sent.

Since most of the time a weapon gameobject (GO) will be parented below an attachment GO on the player avatar (e.g. the hand GO) which already has a photonview component on it, as far as i understand it shouldn't be necessary to have another photonview on the weapon GO. At least as long as i manage to parent the weapon GO to the proper attachment GO on the local client as well as the remote clients. As soon as the attachment object moves the weapon object should move accordingly and use up zero network ressources.

Of course, as soon as a weapon is being dropped or thrown away, the weapon GO would require a photonview in order to synch it's transform to all other clients.

So my first question is: Are the above assumptions correct?

If so i can think of several ways to handle the weapons in terms ob photonviews and RPCs:

1. Parent the weapon GO via an RPC as soon as the weapon is grabbed. Also have a photonview component on the weapon GO which is deactivated as long as the weapon is parented below an attachment GO so that the photonview won't cause any network messages. As soon as the weapon gets unparented i would reactivate the photonview.
--> Is this an advisable approach? Is it even possible to deactivate / activate a photonview during runtime? Is an RPC the proper way to parent a GO to some other GO on all clients?

2. Have a photonview component on the weapon GO which is active all the time but use some feature of the photonview that makes it send messages only when the weapon is not parented below another GO
--> This would require photonview to offer such a feature where messages are only being send when really necessary (maybe unrealibale on change??). Is there such a feature?

I guess my main question here is: How do i prevent unnecessary use of network ressources while a weapon GO is parented below another GO that already gets synched across the network?

I also really would appreciate some step by step guide maybe even with real code or pseudo code.

Thank's in advance!

Cheers!

Comments

  • Qianfulong
    Options
    Anyone? Not even a slight hint from the makers of Photon?