Created
September 15, 2017 06:50
-
-
Save EdSkamor/56554fa0898fb017383b0f60a94a94c5 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 TestCursor : MonoBehaviour | |
{ | |
public float m_maxSpeed = 10f; | |
public float m_rotSpeed = 5f; | |
private Transform m_transform = null; | |
private CharacterController m_controller = null; | |
void Awake() | |
{ | |
m_transform = GetComponent<Transform>(); | |
m_controller = GetComponent<CharacterController>(); | |
} | |
void Update() | |
{ | |
float horz = CrossPlatformInputManager.GetAxis("Horizontal"); | |
float vert = CrossPlatformInputManager.GetAxis("Vertical"); | |
m_transform.rotation *= Quaternion.Euler(0f, m_rotSpeed *horz * Time.deltaTime, 0f); | |
m_transform.position += transform.forward * m_maxSpeed * vert * Time.deltaTime; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment