0

I'm trying to add PUN2 support to a simple Oculus starter scene (cubes on a table). I was able to run the official Avatar synchronization on top of my basic Photon2 setup.

This is the current sequence:

  • Player 1 ( P1 - the one using Quest) creates the room and joins it

  • Player 2 (P2 - the one using Unity Player) joins the room

  • Player 1 grabs a cube and moves it around

P2 sees the cube moving normally if P1 just drags it horizontally, but if he tries to lift it from the table the cube seems acting crazy from P2 point of view.

It looks like the cube fights with gravity but I'm not totally sure what is going on. You can see an example in this video where there is an alternation between horizontal drag and lifting from the table: https://gofile.io/?c=A9PN41

If I disable gravity on the cube it seems working fine (although the interpolation a bit slow compared to how P1 is moving the object): https://gofile.io/?c=jM4qEE

The point is that I cannot have cubes flying around the scene :)

Using Unity 2019.1 / PUN2 / Oculus Quest

JohnTube
  • 1,782
  • 27
  • 46
Claus
  • 5,662
  • 10
  • 77
  • 118
  • 2
    I have already edited the title of your other question, but as you have made the same mistake in this one and this time also made it in the body of the message, this time I write a comment to make you aware of it: This question is about the PUN2 (Photon Unity Networking 2) asset, which is a client for Photon 4 (Photon Cloud also runs Photon 4) - it has nothing to do with Photon 2, which has been succeeded by Photon 3 in 2011, 8 years ago, already. – Kaiserludi Sep 10 '19 at 16:51
  • I approved the edit the first time, so not sure why it got back to the original status. Just done it again, thanks for your explanation. – Claus Sep 11 '19 at 12:32
  • 1
    I did my edit on your other question yesterday (https://stackoverflow.com/questions/57851568/problem-using-pun2-for-a-vr-multiplayer-experience-in-unity-3d). On this question @JohnTube did it 20 hours after my comment. So I guess that you approved my edit on the other question and now approved his one on this question and are just confusing the 2. Otherwise a revert of the edit would show up in the edit-history which it doesn't. – Kaiserludi Sep 11 '19 at 16:15
  • 1
    Ok, I think there was a bit of confusion anyway the important is that now it's fixed. – Claus Sep 12 '19 at 11:58

1 Answers1

2

For the records, I found out what is the problem but still working on a complete solution. When P1 manipulates an object (kept in sync across clients using Photon Transform View), P2 sees the cube trying to synchronize its position/rotation while fighting against gravity (creating that weird jumpy behavior).

After an extensive I research I found out a possible approach which could solve the problem:

  • Add a Photon Rigid Body View (sync velocity and angular velocity)
  • Add an RPC (activated during manipulation) which:
    • Disables gravity
    • Enables isKinematic
    • Transfer ownership to the Player which is manipulating the object.

This needs to be fully tested on both clients (Master/Normal), but so far the results seem promising.

Claus
  • 5,662
  • 10
  • 77
  • 118
  • thanks for posting your answer to your problem... ive been looking all over for a solution. Out of interest, have you found any other working solution? or is this the best answer (voted up by the way) – treendy Feb 20 '20 at 06:52
  • (I am finding that i only need to enable "isKinematic", and transfer ownership, no need to disable gravity, and didnt need to sync velocity and angular velocity) – treendy Feb 20 '20 at 07:09
  • So you're not using a `Photon Rigid Body View` Script? – Claus Feb 22 '20 at 14:43
  • Even if I leave gravity set to true on the object and I activate isKinetic while manipulating it, I cannot throw the object around. As soon I try to throw it the object goes back to hist last position before been thrown. – Claus Feb 22 '20 at 15:40