playMaker

Author Topic: VRTK and Photon: PUN Instantiated Scene Object movements visible only to owner  (Read 2617 times)

ToxicFrog

  • Beta Group
  • Full Member
  • *
  • Posts: 139
Hey Playmakers,

I'm working on a VR project using VRTK, Playmaker, and PUN2 (with the PM actions).

I have avatars for 2 players that use Final IK and the VRIK component. This works as intended - each player can see the other. The head, hands, body all move as expected and both players see the movements as they should.

I use PUN2 to instantiate a scene object (a cube), that is a VRTK interactable object that can be picked up. The cube has a Photon Game Object Proxy component as well as a Photon Transform View component.

When the player that is the Master picks up the cube, the other player sees it in the Master Player's hand, as expected.

However, when the non-Master player picks up the cube, the other player (Master) does NOT see the cube in the player's hand. He sees it on the ground in its original place as if it were never picked up.

Any thoughts or suggestions?

Thanks!

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Hi,

 it's because non master can not control and should not move networked scene objects, they don't own it.

 either, request ownership for that player, and then the master acknoledge that request and transfers ownership, or the player has to tell the master to move that networked scene object to a given position.

Bye,

 Jean

ToxicFrog

  • Beta Group
  • Full Member
  • *
  • Posts: 139
Thanks, jean!

I understand what you are saying.

If I understand correctly, in the Photon View component, the 'Owner' property should be set to 'Request' or 'Takeover'?

I see PM actions to request ownership, but no actions or events to give ownership. Am I missing something?

Also, does 'Takeover' mean that it forces ownership to the one requesting, without allowing the request to be denied?


jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Hi,

 set it to TakeOver and it will work as soon as you make a request using the action RequestOwnerShip

Quote

    "Fixed" owner keeps the creator of a GameObject as owner.
    "Takeover" enables any client to take the GameObject from the current owner.
    "Request" asks the current owner to pass it over. This can be rejected.


if you need a potential rejection, let me know, I can enable that, but I need to implement some more coding.

Make sure you read this, ignore the code, just read what they say about ownership : https://doc.photonengine.com/en-us/pun/v1/demos-and-tutorials/package-demos/ownership-transfer


Bye,

 Jean

teodor

  • Playmaker Newbie
  • *
  • Posts: 2
Hi there.

Did you manage to fix this issue? Thanks

ToxicFrog

  • Beta Group
  • Full Member
  • *
  • Posts: 139
Honestly, this project got cancelled so I never had to solve the problem, LOL

BUT! It appears that assigning ownership would solve it - see jeanfabre's link above!

teodor

  • Playmaker Newbie
  • *
  • Posts: 2
Hello,
Yes, I read all the comments and PUN docs and I tried implementing the part with the Takeover setting and using the action RequestOwnerShip, but for some reason it is not working yet. I guess I am missing something..

Thanks

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Hi,

 Do you get any errors in the console? maybe you can increase the log level in pun to see what's going on?

Bye,

 Jean