Skip to content

Instantly share code, notes, and snippets.

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