December 2013
Beginner
242 pages
4h 23m
English
Before we can apply interpolation or prediction, we'll need a base to build off of. We'll create a networked object which can be moved around via arrow keys. We'll start with absolutely no interpolation whatsoever—the object instantly appears at the newest location received over the network.
First, let's create a very simple player script.
using UnityEngine;
using System.Collections;
public class Player : MonoBehaviour
{
public float MoveSpeed = 5f;
void Update()
{
if( networkView == null || networkView.isMine )
{
transform.Translate( new Vector3( Input.GetAxis( "Horizontal" ), 0, Input.GetAxis( "Vertical" ) ) * MoveSpeed * Time.deltaTime );
}
}
}This script is very basic. It simply checks if the network view belongs ...
Read now
Unlock full access