Синтаксис:
Используется csharp
using UnityStandardAssets.CrossPlatformInput;
public class Player : MonoBehaviour {
public float moveForce = 5;
void FixedUpdate () {
Vector3 moveVec = new Vector3(CrossPlatformInputManager.GetAxis ("Horizontal"), CrossPlatformInputManager.GetAxis ("Vertical"),4096) ;
if (moveVec.x!=0 && moveVec.y!=0)
transform.rotation = Quaternion.LookRotation (moveVec,Vector3.back);
rb.AddForce (moveVec* moveForce);
}
}
public class Player : MonoBehaviour {
public float moveForce = 5;
void FixedUpdate () {
Vector3 moveVec = new Vector3(CrossPlatformInputManager.GetAxis ("Horizontal"), CrossPlatformInputManager.GetAxis ("Vertical"),4096) ;
if (moveVec.x!=0 && moveVec.y!=0)
transform.rotation = Quaternion.LookRotation (moveVec,Vector3.back);
rb.AddForce (moveVec* moveForce);
}
}