Hi I have been looking at how to apply smoothing to PUN+ multiplayer and the tutorials I have found refer to a motor controller component on the standard assets FPController. However there is no motor controller component on the current FPC… So I have no other option than to ignore parts of tutorials that suggest disabling this to solve smoothing alongside a CharacterNetwork script that implements this code on the movement that uses Lerp:
privateVector3 correctPlayerPos = Vector3.zero; // We lerp towards this
privateQuaternion correctPlayerRot = Quaternion.identity; // We lerp towards this
// Update is called once per frame
void Update()
{
if (!photonView.isMine)
{
transform.position = Vector3.Lerp(transform.position, this.correctPlayerPos, Time.deltaTime * 10f);
transform.rotation = Quaternion.Lerp(transform.rotation, this.correctPlayerRot, Time.deltaTime * 10f);
}
else
{
// transform.position = Vector3.Lerp(transform.position, this.correctPlayerPos, Time.deltaTime * 120f);
//transform.rotation = Quaternion.Lerp(transform.rotation, this.correctPlayerRot, Time.deltaTime * 120f);
}
}
void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
{
if (stream.isWriting)
{
// We own this player: send the others our data
stream.SendNext(transform.position);
stream.SendNext(transform.rotation);
// FirstPersonController myC = GetComponent();
//stream.SendNext((int)myC._characterState);
}
else
{
// Network player, receive data
this.correctPlayerPos = (Vector3)stream.ReceiveNext();
this.correctPlayerRot = (Quaternion)stream.ReceiveNext();
// myThirdPersonController myC = GetComponent();
// myC._characterState = (CharacterState)stream.ReceiveNext();
}
}
This is however taken from the tutorials supplied with Pun+.
What I am finding is when the player moves within a room he moves but when you let go its as if he slowly reduces speed… So if you jump he falls back down but before he gets to the ground he slowly and smoothly moves back to the original position. Ideal I want a smooth transition but not this slowing effect.
I have no idea how to achieve this and cant find a solution that refers to the new FPC .
Any help would be great.
new to all this but its damn awesome.
Thanks
Daniel