quintesse / PlayoVR

A Unity demo project using VRTK, PhotonNetwork and PUNVoice
MIT License
145 stars 37 forks source link

Interactable objects stutter, lerp not working #14

Open jasonofthestorm opened 4 years ago

jasonofthestorm commented 4 years ago

Amazing work, really happy to have a networked project up and running! I noticed that networked objects appear to move at a lower framerate. I see the objects have their transforms set to lerp but it isn't smoothing out the movement. Since you mention that your scripts for this aren't actually necessary, I tried the default Photon scripts instead which work great, so I will just use them moving forward. Still, I am curious about why your script isn't working, and the potential benefits if I can get it working.

quintesse commented 4 years ago

Glad you like PlayoVR! And thanks for opening this issue because it's indeed something I need to look into. Those scripts used to work but I must have broken them at some time. They are indeed not necessary, I just liked my implementation better than the stock PUN one (but then they should of course work as advertised)

brainsplitterstudios commented 4 years ago

Great! I'm starting to see the advantages that would come with yours, particularly when it comes to combining transforms with rigidbody velocities.

Do you recall if your script had a solution for interpolated held objects with physics? If the object is an interpolated non-kinematic rigidbody being held by one client, other clients will see it drop to the floor or jerk up and down below the hand (because there is no grab attach joint to hold the object in place on their end, the Transform view is fighting with gravity on the rigidbody). I wrote a script which sends an RPC to make the object kinematic for all clients besides the user grabbing it which seems to work great, but I'd love to know what you were doing too, or if you have any advice on dealing with that.

Thanks so much!

quintesse commented 4 years ago

Yeah, that's actually one of the features of the NetworkObject: https://github.com/quintesse/PlayoVR#about-parent-option, it not only handles movement but also any reparenting that happens. And any object that is made a child of another object automatically become kinematic, so no need to send that explicitly. It also means that the state on the remote client more closely resembles the local one.

blanxdev commented 4 years ago

Did anyone figure out how to improve the stuttering? I think it is somehow related that the values are not lerped in the update loop.