Quantcast
Channel: Recent Discussions — Photon Engine
Viewing all articles
Browse latest Browse all 15755

Player Smoothness across network

$
0
0
Hello everyone, I have been working on a project with multiplayer and the moment of the player is working however it is very glitchy and jitters a lot. Is there a way how I can make move moment smoother for other players?

In terms of networking I have been following this tutorial image but for my project I am using the 3D cylinder as my player.

I have 2 scripts, one is the Network Manager which is this:

using UnityEngine;
using System.Collections;

public class NetworkManager : MonoBehaviour
{
const string VERSION = "v0.0.1";
public string roomName = "VVR";
public string playerPrefabName = "FPSController";
public Transform spawnPoint;

void Start()
{
PhotonNetwork.ConnectUsingSettings(VERSION);
}

void OnJoinedLobby()
{
RoomOptions roomOptions = new RoomOptions() { isVisible = false, maxPlayers = 4 };
PhotonNetwork.JoinOrCreateRoom(roomName, roomOptions, TypedLobby.Default);

}



void OnJoinedRoom()
{
PhotonNetwork.Instantiate(playerPrefabName,
spawnPoint.position,
spawnPoint.rotation,
0);
}
}



And the other is the NetworkPlayer which is this:

using UnityEngine;
using System.Collections;

public class NetworkPlayer : Photon.MonoBehaviour {
public GameObject myCamera;

// Use this for initialization
void Start () {
if(photonView.isMine) {
myCamera.SetActive(true);
GetComponent().enabled = true;
}
else{
}
}
}



Any help on this issue would be much appreciated. Thank you.

Viewing all articles
Browse latest Browse all 15755

Trending Articles