- Home /
Network - Player Doesn't Move Smoothly On Clients
Hello,
I'm working on a 2D top down multiplayer game, and the problem I'm having is that when viewing client players, when they move around, its not very smooth. Its pretty jittery.
In fact, its mainly when the client rotates. Moving forward, or side to side looks fine, its just the rotation. The rotation is based on the mouse position, so if you circle your mouse around the character, the character will rotate so its always 'looking' at the mouse.
Thats the bit that looks 'jerky', this is only when VIEWING a client. My character that I control on the other hand looks fine, but if I were to look at my character on another client, it appears jerky. So it must be something to do with the network. The code that controls the rotation (all movement for that matter) is in an Update Function, and has no RPCs:
var ray = Camera.main.ScreenPointToRay (Input.mousePosition);
var playerRotateSpeed = 10;
var hitdist = 0.0;
var targetPoint = ray.GetPoint(hitdist);
var lookPos = targetPoint - transform.position;
lookPos.y = 0;
if(canMove){
var targetRotation = Quaternion.LookRotation(lookPos);
transform.rotation = Quaternion.Slerp(transform.rotation, targetRotation, playerRotateSpeed * Time.deltaTime);
}
I doubt the problem is in here, so let me list my Network Views too:
Player(NetworkRigidbody) [Reliable Delta Compressed]
Player(HealthSystem) [Reliable Delta Compressed] (Holds my health variables)
Player(Rigidbody) [Reliable Delta Compressed]
I also have a RigidAssign, I'm not 100% sure what this does, but it was in the Multiplayer Tutorial. I also have a NetworkRigidbody, again was on the tutorial.
Any ideas what might be causing this?
Thanks.
Are you sure a networkView is set to observe the NetworkRigidbody ins$$anonymous$$d of the players transform?