Skip to content

Instantly share code, notes, and snippets.

@bibinba
Last active June 3, 2018 09:22
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 bibinba/6e835f058e8f284e41a962bfe5f2dcd6 to your computer and use it in GitHub Desktop.
Save bibinba/6e835f058e8f284e41a962bfe5f2dcd6 to your computer and use it in GitHub Desktop.
OculusGoの操作
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class GoSousa: MonoBehaviour {
public GameObject yellow;
public GameObject pink;
public GameObject leo;
public GameObject camera1;
int a;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if (OVRInput.GetDown(OVRInput.Button.PrimaryIndexTrigger))
{
////トリガー押されたら
yellow.SetActive(false);
}
if (OVRInput.GetDown(OVRInput.Button.Back))
{
///戻るボタン押されたら
pink.SetActive(false);
}
if (OVRInput.GetDown(OVRInput.Button.PrimaryTouchpad))
{
////タッチパッド押されたら
pink.SetActive(true);
}
if (OVRInput.GetDown(OVRInput.Touch.PrimaryTouchpad))
{
///タッチパッド触れられたら
//pink.SetActive(false);
}
Vector2 pt = OVRInput.Get(OVRInput.Axis2D.PrimaryTouchpad); ///タッチパッドの位置
if (pt.x < -0.5 && -0.5 < pt.y && pt.y < 0.5)///左側?
{
camera1.transform.position += new Vector3(-0.1f* Time.deltaTime, 0, 0 );
}
if (pt.x > 0.5 && -0.5 < pt.y && pt.y < 0.5)///右側?
{
camera1.transform.position += new Vector3(0.1f* Time.deltaTime, 0, 0 );
}
if (pt.y < -0.5 && -0.5 < pt.x && pt.x < 0.5)///下側?
{
camera1.transform.position += new Vector3(0, 0, -0.1f * Time.deltaTime);
}
if (pt.y > 0.5 && -0.5<pt.x && pt.x<0.5)///上側?
{
camera1.transform.position += new Vector3(0, 0, 0.1f * Time.deltaTime);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment