Last active
September 15, 2017 07:06
-
-
Save EdSkamor/e2f596902fd799a1e7523b725719cc16 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
using UnityStandardAssets.CrossPlatformInput; | |
public class chaCon : MonoBehaviour { | |
private Rigidbody m_rb; | |
[SerializeField] float m_speed = 10f; | |
void Start () { | |
m_rb = GetComponent<Rigidbody>(); | |
} | |
void Update () { | |
float x = CrossPlatformInputManager.GetAxis("Horizontal"); | |
float z = CrossPlatformInputManager.GetAxis("Vertical"); | |
Vector3 movement = new Vector3(x, 0f, z); | |
m_rb.AddForce(movement * m_speed); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment