The Photon Forum
is Closed Permanently.

After many dedicated years of service, we have made the decision to retire our Forum and switch to read-only: we´ve saved the best to last! Your search result can be found below. Plus, we offer support via these channels:

Try Our
Documentation

Please check if you can find an answer in our extensive documentation on PUN.

Join Us
on Discord

Meet and talk to our staff and the entire Photon-Community via Discord.

Read More on
Stack Overflow

Find more information on Stack Overflow (for Circle members only).

Write Us
an E-Mail

Feel free to send your question directly to our developers.

PhotonTransformView and PhotonRigidbodyView

slothbro
2016-08-22 04:35:33

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

Psyco
2016-09-30 01:24:05

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)

jeanfabre
2016-09-30 10:36:29

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

Spaggi
2016-12-06 12:11:06

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?

jeanfabre
2016-12-06 12:18:47

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

Spaggi
2016-12-06 12:36:19

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

mmax
2016-12-10 16:02:55

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

Spaggi
2016-12-10 19:49:19

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

mmax
2016-12-11 11:46:31

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

jeanfabre
2016-12-12 12:22:27

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

mmax
2016-12-12 17:11:39

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

Spaggi
2016-12-18 22:17:53

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

jeanfabre
2016-12-20 11:43:41

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

milo_2008
2020-03-28 11:20:30

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

Back to top