I didn’t know whether to post this here or under the script section, but here’s the problem. I’m trying to find a script that has a character (sphere) located on the screen and it has to be manipulable by character controls. Thanks in advance!
Try this:
// Non physics
var speed : float = 20.0;
function Update ()
{
var x : float = Input.GetAxis ("Horizontal");
var z : float = Input.GetAxis ("Vertical");
transform.Translate (x * Time.deltaTime * speed, 0, z * Time.deltaTime * speed);
}
// Physics
var speed : float = 20.0;
function Start ()
{
if (!rigidbody)
gameObject.AddComponent (typeof Rigidbody);
}
function FixedUpdate ()
{
var x : float = Input.GetAxis ("Horizontal");
var z : float = Input.GetAxis ("Vertical");
rigidbody.AddForce (x * speed, 0, z * speed);
}