Skip to content

Instantly share code, notes, and snippets.

@EdSkamor
Created September 15, 2017 06:50
Show Gist options
  • Save EdSkamor/56554fa0898fb017383b0f60a94a94c5 to your computer and use it in GitHub Desktop.
Save EdSkamor/56554fa0898fb017383b0f60a94a94c5 to your computer and use it in GitHub Desktop.
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