Skip to content

Instantly share code, notes, and snippets.

@urahimono
Created July 25, 2016 08:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save urahimono/1b1812b53eb92523cb4ebffe67310ee2 to your computer and use it in GitHub Desktop.
Save urahimono/1b1812b53eb92523cb4ebffe67310ee2 to your computer and use it in GitHub Desktop.
UnityのCrossPlatformInputを使う その6 MobileTiltControlRig編
using UnityEngine;
using UnityStandardAssets.CrossPlatformInput;
public class Test : MonoBehaviour
{
[SerializeField]
private float m_speedScale = 3.0f;
void Update()
{
float vertical = CrossPlatformInputManager.GetAxis( "Vertical" );
float horizontal = CrossPlatformInputManager.GetAxis( "Horizontal" );
Vector3 addPos = new Vector3( horizontal, vertical, 0.0f ) * m_speedScale;
transform.position += addPos * Time.deltaTime;
}
} // class Test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment