// http://www.gameobject.net/?p=1227 Unity multiplayer tutorial calculations on server // InputReceiver.cs // This script receives input commands from the client and applies forces to the // gameobject is attached to to cause its motion. Rigidbody needed using UnityEngine; using System.Collections; using uLink; public class InputReceiver : uLink.MonoBehaviour { [RPC] // Define a Remote Procedure Call to be called by the client void AddForceZ(int amount) // Z direction is parallel to the goal { this.rigidbody.AddForce(new Vector3(0, 0, amount)); //Apply force in the Z direction } [RPC] // Same for velocity void SetVelocity(float verticalAmount) { this.rigidbody.velocity = new Vector3(0, 0, verticalAmount); } }