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).
Jittery player movement
Moomit
2021-08-06 16:57:19
I coded a simple method to sync player movement in Unity using Photon Pun2.The problem is when the player moves,the other player sees him moving very jittery.I found out its caused by the code i implemented,but i havent found any good soulution to fix it.
Player Code (the movements sync part):
Comments
Use Lerp Like this:
You can change 0.1f as you wish.
@Pablo77 wrote: »
Use Lerp Like this:
You can change 0.1f as you wish.transform.position = Vector3.Lerp(transform.position, latestPos, 0.1f);
So i should create a int or vector for latestPos?
@Moomit wrote: »
@Pablo77 wrote: »
Use Lerp Like this:
You can change 0.1f as you wish.
transform.position = Vector3.Lerp(transform.position, latestPos, 0.1f);
So i should create a int or vector for latestPos?
latestPos is Recieved Data From Stream. Its Vector3.
@Pablo77 wrote: »
@Moomit wrote: »
@Pablo77 wrote: »
Use Lerp Like this:
You can change 0.1f as you wish.
transform.position = Vector3.Lerp(transform.position, latestPos, 0.1f);
So i should create a int or vector for latestPos?
latestPos is Recieved Data From Stream. Its Vector3.
When i tried to create like a private Vector3 latestPos
then create the function
and then adding it to the (stream.IsReading)
like latestPos = (Vector3)stream.ReceiveNext();
I am kinda confused how the syncing works
it looks like it needs to work.now what's the error?
@Pablo77 wrote: »
it looks like it needs to work.now what's the error?
There is no error actually,the problem is that the smooth movement and this segment:
make the other player move very jittery. I tried to find a solution to fix this but had no luck
@Moomit wrote: »
@Pablo77 wrote: »
it looks like it needs to work.now what's the error?
There is no error actually,the problem is that the smooth movement and this segment:
make the other player move very jittery. I tried to find a solution to fix this but had no luck
Honestly photon is little problem for really smooth transform. Maybe you can try Smooth Sync (Paid Asset). But this code works fine on me
I am using Photon Rigidbody View and OnPhotonSerializeView together. The output is really great like i cannot understand the delay or any jittering.
Back to top