-
-
Save neon-izm/f36763a35a63e1250a8c to your computer and use it in GitHub Desktop.
Ovrvision SDK v0.5で、Unityのシーン内でマーカの位置(OvrvisionView)を動かすのではなく、OVRCameraControllerを動かす場合の書き方
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
/// <summary> | |
/// This class provides main interface to the Ovrvision Ex | |
/// </summary> | |
public class OvrvisionTracker : MonoBehaviour { | |
GameObject MainCameraOBJ; | |
void Start(){ | |
//Get OVRCameraController | |
MainCameraOBJ=GameObject.FindWithTag("CameraControl"); | |
} | |
//var | |
public int markerID = 0; | |
//define | |
private const int MARKERGET_ARG10 = 10; | |
// ------ Function ------ | |
// UpdateTracker | |
public void UpdateTransform (float[] markerGet, int elementNo) { | |
int i = elementNo * MARKERGET_ARG10; | |
Quaternion current_q= new Quaternion (markerGet[i+4],markerGet[i+5],markerGet[i+6],markerGet[i+7]); | |
Quaternion camera_q=Quaternion.Inverse(current_q); | |
MainCameraOBJ.transform.localRotation=camera_q; | |
MainCameraOBJ.transform.localPosition=Vector3.zero; | |
MainCameraOBJ.transform.Translate(new Vector3(-markerGet[i+1],-markerGet[i+2],-markerGet[i+3])); | |
} | |
public void UpdateTransformNone () { | |
MainCameraOBJ.transform.localPosition=new Vector3 (-1000.0f, -10000.0f, -1000.0f); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment