Created
September 15, 2017 06:44
-
-
Save EdSkamor/5a576fadbf5d41e211f9a74ce079d5e3 to your computer and use it in GitHub Desktop.
FixedController
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 What3 : MonoBehaviour | |
{ | |
public float m_maxSpeed = 10f; | |
public float m_rotSpeed = 5f; | |
private Transform m_transform = null; | |
// Use this for initialization | |
void Start() | |
{ | |
m_transform = GetComponent<Transform>(); | |
} | |
// Update is called once per frame | |
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