PhotonTransformView and PhotonRigidbodyView

Long and short of it is, if the players have rigidbodies, what should I use to synchronize it?

I'm currently using transform view but unfortunately even with interpolation/extrapolation, it's rather choppy. Even under ideal circumstances, it takes the other player's position half a second to react to any explosions/whatever. Same result if I use both in conjunction. If i use just a rigidbody view the position is completely incorrect.

Any suggestions?

Comments

  • I am wondering the same thing, Are people using these components successfully? I have found going back to manual control in the OnPhotonSerializeView is best.
    Cant get smooth movement to work in any combination of settings or components (transformView, RigidbodyView)
  • Hi,

    You need to update to the latest version of photon, some work has been done to improve synchronization. Can you confirm you are using the latest version but still witness bad latency, and if so can you make a screenshot of your photonView observed component.

    also, I remember another post where the developer was not observing the right component and so it was sitting here but not taking any active role to interpolate position... So make sure you are not observing the transform itself, but rather the photonTransformView or PhotonRigidBodyView.

    Bye,

    Jean
  • Hi,

    without the issue of the OP in mind: What is the best practice to synchronize Rigidbodies as smooth as possible?

    PTV or RBV? Or can both be used at the same time?
  • Hi,

    you'll have to actually use both to avoid drifting:

    here the RBV summary:

    This class helps you to synchronize the velocities of a physics RigidBody.
    /// Note that only the velocities are synchronized and because Unitys physics
    /// engine is not deterministic (ie. the results aren't always the same on all
    /// computers) - the actual positions of the objects may go out of sync. If you
    /// want to have the position of this object the same on all clients, you should
    /// also add a PhotonTransformView to synchronize the position.
    /// Simply add the component to your GameObject and make sure that
    /// the PhotonRigidbodyView is added to the list of observed components


    If you are looking for a deterministic physics, make sure to check out the new TrueSynch product from Exitgames.

    https://www.photonengine.com/en-US/TrueSync

    Bye,

    Jean
  • Hi jean,

    thanks a lot for the quick answer. Haven't tried using both yet but this seems to be an interesting approach.

    TrueSync Sounds interesting, but I'm making a VR game which seems not to be working well as stated on your TrueSync page
  • Hi Jean,
    I checked both TranformView and RigidbodyView. They do not "work together". They both synchronize "their own stuff". I would like to raise a suggestion to PUN developers to implement an extrapolate option which will not estimate speed and turn but will use actual values (velocity and angular velocity) which will be read from rigidbody component, which can be synchronized by Rigidbody view.

    something like this:
    
            case PhotonTransformViewPositionModel.ExtrapolateOptions.RigidbodyExperimental:
                extrapolatePosition = rigidbody.velocity * timePassed;
                break
  • Hi mmax,

    Why does it not work with both views? I would have thought that the Transform View syncs the transform and the Rigidbody View adjusts velocities making the movement smoother on the receiving end
  • Hi, I thought that too. But I am unable to get rid of jerkiness, I looked at the source code and I didnt find any connection between TransformView and RigidbodyView.
    Maybe Im doing something wrong. It seems to as If the position isnt updated (extrapolated) between two consecutive network packets.
    I tried every combination of interpolate and extrapolate, Rigidbody kinematic on/off. Results almost the same.
    Here a video:
    https://youtu.be/sTE57TugCrA
  • Hi,

    they work in combination, they don't share data, Transform synch position, and rigidbody thinks velocity.

    indeed, that's pretty bad. I would not use extrapolation at all, but instead lerping and smoothing or interpolation, but not extrapolation, you'll always over shoot and it looks bad.

    you'll have to toy around with the photon transform teleport value to avoid the transform catching up too often.

    can you do a screenshot of your components setup? here's mine:




    Bye,

    Jean
  • Hi,
    I tried all type of setting, nothing worked as I desired.
    The best result so far, although not perfect, I got using this script. But of course I converted it into photon. Another thing was that I had to set the interpolation time to 0.2.
    BTW: This script uses rigidbody velocity in extrapolation.

    Anyway, thanks for your effort

  • Dear jeanfabre,

    I just wanted to give you a quick feedback for your answer.

    I achieved FANTASTIC results with your settings! The Object simulation is now really fluid and accurate!

    Thank you so much for sharing this!!

    Maybe it would make sense to publish some kind of best-practice for this, I can imagine a lot of people don't know they should add both view
  • Hi,

    This is a great news, a lot of people indeed to struggle with this, I am glad you found this useful. I raised a ticket internally to make that clear in the doc, you are right about making this a bigger/obvious statement.

    Bye,

    Jean
  • I know this post is from 4 years ago but when i found it and used the variables from jeanfabre everything was very smooth