Для управления сферой:
На C#
playerController
Код
using UnityEngine;
using System.Collections;
public class playerController : MonoBehaviour {
public float speed;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
void FixedUpdate() {
float moveHorizontal;
float moveVertical;
if (Application.platform == RuntimePlatform.Android) {
moveHorizontal = Input.acceleration.x;
moveVertical = Input.acceleration.y;
} else {
moveHorizontal = Input.GetAxis ("Horizontal");
moveVertical = Input.GetAxis ("Vertical");
}
Vector3 movement = new Vector3 (moveHorizontal, 0.0f, moveVertical);
rigidbody.AddForce(movement * speed * Time.deltaTime);
}
}