Skip to content

Instantly share code, notes, and snippets.

@EdSkamor
Created September 14, 2017 10:15
Show Gist options
  • Save EdSkamor/a81f2651007d8f0b6cf6f2f145b6b7ed to your computer and use it in GitHub Desktop.
Save EdSkamor/a81f2651007d8f0b6cf6f2f145b6b7ed to your computer and use it in GitHub Desktop.
This same as last but with Rotating Cube
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CubeControll : MonoBehaviour {
private float m_vert;
private float m_horz;
private float m_rotat;
private float mouseX;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
m_vert = Input.GetAxis("Vertical");
m_horz = Input.GetAxis("Horizontal");
float mouseX = Input.GetAxis("Mouse X");
transform.Rotate(0f, mouseX, 0f);
transform.Translate(m_horz, 0f, m_vert);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment