本文整理汇总了C#中OVRCameraController类的典型用法代码示例。如果您正苦于以下问题:C# OVRCameraController类的具体用法?C# OVRCameraController怎么用?C# OVRCameraController使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OVRCameraController类属于命名空间,在下文中一共展示了OVRCameraController类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AttachCorrectCameraModule
public void AttachCorrectCameraModule()
{
GameObject cameraHolder = GameObject.FindWithTag("CameraHolder");
// Cleanup up previous camera (if it exists)
if( cameraHolder.transform.childCount > 0)
Destroy(cameraHolder.transform.GetChild(0).gameObject, 0.0f);
// Add correct camera module
if(isOVR)
{
GameObject ovrModule = (GameObject)Instantiate(ovrCameraControllerModulePrefab, new Vector3(), Quaternion.identity);
//ovrModule.transform.Rotate(new Vector3(0, -90, 0), Space.Self);
ovrModule.transform.parent = cameraHolder.transform;
ovrModule.transform.localPosition = new Vector3();
ovrCameraController = (OVRCameraController)GameObject.FindWithTag("OVRCameraController").GetComponent("OVRCameraController");
mainCameraGameObject = GameObject.FindWithTag("MainCamera");
GameObject[] tempCameraObjectArray = GameObject.FindGameObjectsWithTag("MainCamera");
mainCameraComponentList.Clear();
for(int i = 0; i < tempCameraObjectArray.Length; i++)
mainCameraComponentList.Add( (Camera)tempCameraObjectArray[i].GetComponent("Camera") );
}
else
{
GameObject normalCameraModule = (GameObject)Instantiate(mainCameraModulePrefab, new Vector3(), Quaternion.identity);
//normalCameraModule.transform.Rotate(new Vector3(0, -90, 0), Space.Self);
normalCameraModule.transform.parent = cameraHolder.transform;
normalCameraModule.transform.localPosition = new Vector3();
mainCameraGameObject = GameObject.FindWithTag("MainCamera"); //GameObject.Find("Main Camera");
}
}
示例2: Start
void Start()
{
coatLeft = transform.Find("coatLeft");
coatRight = transform.Find("coatRight");
ovrController = transform.parent.parent.GetComponent<OVRCameraController>();
isHiding = false;
calledHiding = false;
coatRight.localPosition = cRight = new Vector3(maxCoatRightX, 0f, 0f);
coatLeft.localPosition = -cRight;
}
示例3: SetOVRCameraController
// SetOVRCameraController
public void SetOVRCameraController(ref OVRCameraController cameraController)
{
CameraController = cameraController;
CameraController.GetCamera(ref MainCam);
if(CameraController.PortraitMode == true)
{
float tmp = DeadZoneX;
DeadZoneX = DeadZoneY;
DeadZoneY = tmp;
}
}
示例4: Awake
void Awake()
{
// Find camera controller
OVRCameraController[] camera_controllers;
camera_controllers = gameObject.GetComponentsInChildren<OVRCameraController>();
if (camera_controllers.Length == 0)
Debug.LogWarning("ThreeDimGUI: No OVRCameraController attached.");
else if (camera_controllers.Length > 1)
Debug.LogWarning("ThreeDimGUI: More then 1 OVRCameraController attached.");
else
m_CameraController = camera_controllers[0];
}
示例5: Awake
void Awake()
{
ovrCameraController = GetComponentInChildren<OVRCameraController>();
ovrCameraControllerTransform = ovrCameraController.transform;
headController = GetComponent<HeadController>();
handsController = GetComponent<HandsController>();
feetController = GetComponent<FeetController>();
motionController = GetComponent<MotionController>();
swooshSound = ovrCameraControllerTransform.Find("SwooshSound").GetComponent<AudioSource>();
materialTriggers = GameObject.FindObjectsOfType( typeof (TriggerSolidColor ) ) as TriggerSolidColor[];
foreach ( CameraAnchor cameraAnchor in GameObject.FindObjectsOfType( typeof(CameraAnchor) ))
characterCameraAnchorTransforms.Add( cameraAnchor.transform );
}
示例6: Start
public void Start()
{
CurrentState = PlayerState.Normal;
_changingState = false;
_manager = GameObject.FindGameObjectWithTag("GameManager").GetComponent<GameManager>();
_terrainCollider = GameObject.FindGameObjectWithTag("Terrain").GetComponent<TerrainCollider>();
_sunLight = GameObject.FindGameObjectWithTag("SunLight").GetComponent<Light>();
_startIntensity = _sunLight.intensity;
_ovrPlayerController = GetComponent<OVRPlayerController>();
_ovrCameraController = GetComponentInChildren<OVRCameraController>();
_audioManager = GameObject.FindGameObjectWithTag("AudioManager").GetComponent<AudioManager>();
}
示例7: Start
// Use this for initialization
void Start()
{
movement = Vector3.zero;
controller = gameObject.GetComponent<CharacterController>();
OVRCameraController[] CameraControllers;
CameraControllers = gameObject.GetComponentsInChildren<OVRCameraController>();
if(CameraControllers.Length == 0)
Debug.LogWarning("OVRPlayerController: No OVRCameraController attached.");
else if (CameraControllers.Length > 1)
Debug.LogWarning("OVRPlayerController: More then 1 OVRCameraController attached.");
else
CameraController = CameraControllers[0];
}
示例8: Awake
// Awake
void Awake()
{
CameraController = GetComponentInChildren(typeof(OVRCameraController)) as OVRCameraController;
if(CameraController==null){
Debug.LogWarning("Single Method Failed!");
// Find camera controller
OVRCameraController[] CameraControllers;
CameraControllers = gameObject.GetComponentsInChildren<OVRCameraController>();
if(CameraControllers.Length == 0)
Debug.LogWarning("OVRMainMenu: No OVRCameraController attached.");
else if (CameraControllers.Length > 1)
Debug.LogWarning("OVRMainMenu: More then 1 OVRCameraController attached.");
else
CameraController = CameraControllers[0];
}
}
示例9: Awake
// * * * * * * * * * * * * *
// Awake
public new virtual void Awake()
{
base.Awake ();
// We use Controller to move player around
Controller = gameObject.GetComponent<CharacterController> ();
if (Controller == null)
Debug.LogWarning ("OVRPlayerController: No CharacterController attached.");
// We use OVRCameraController to set rotations to cameras,
// and to be influenced by rotation
OVRCameraController[] CameraControllers;
CameraControllers = gameObject.GetComponentsInChildren<OVRCameraController> ();
if (CameraControllers.Length == 0)
Debug.LogWarning ("OVRPlayerController: No OVRCameraController attached.");
else if (CameraControllers.Length > 1)
Debug.LogWarning ("OVRPlayerController: More then 1 OVRCameraController attached.");
else
CameraController = CameraControllers [0];
// Instantiate a Transform from the main game object (will be used to
// direct the motion of the PlayerController, as well as used to rotate
// a visible body attached to the controller)
DirXform = null;
Transform[] Xforms = gameObject.GetComponentsInChildren<Transform> ();
for (int i = 0; i < Xforms.Length; i++) {
if (Xforms [i].name == "ForwardDirection") {
DirXform = Xforms [i];
break;
}
}
if (DirXform == null)
Debug.LogWarning ("OVRPlayerController: ForwardDirection game object not found. Do not use.");
}
示例10: Start
// Use this for initialization
void Start()
{
Time.timeScale=1;
leftarrows = (Texture)Resources.Load("leftarrow");
rightarrows = (Texture)Resources.Load("rightarrow");
uparrows = (Texture)Resources.Load("uparrow");
left.renderer.material.color = Color.yellow;
right.renderer.material.color = Color.yellow;
straight.renderer.material.color = Color.yellow;
ovr = GameObject.Find("OVRCameraController").GetComponent<OVRCameraController>();
}
示例11: Start
/// <summary>
/// Start this instance.
/// </summary>
void Start()
{
// Get the OVRCameraController
CameraController = GetComponent<OVRCameraController>();
if(CameraController == null)
Debug.LogWarning("WARNING: OVRCameraController not found!");
// Without this, we will be drawing 1 frame behind
camera.depth = Mathf.Max (CameraLeft.depth, CameraRight.depth) + 1;
// Don't want the camera to render anything..
camera.cullingMask = 0;
camera.eventMask = 0;
camera.useOcclusionCulling = false;
camera.backgroundColor = Color.black;
camera.clearFlags = (!CameraController.UseCameraTexture) ? CameraClearFlags.Nothing :
CameraClearFlags.SolidColor; // TBD: This may be a performance loss on mobile.
camera.renderingPath = RenderingPath.Forward;
camera.orthographic = true;
}
示例12: SetOVRCameraController
/// <summary>
/// Sets the OVR camera controller.
/// </summary>
/// <param name="cameraController">Camera controller.</param>
public void SetOVRCameraController(ref OVRCameraController cameraController)
{
CameraController = cameraController;
CameraController.GetCamera(ref MainCam);
}
示例13: Start
// Start
new void Start()
{
base.Start ();
// Get the OVRCameraController
CameraController = gameObject.transform.parent.GetComponent<OVRCameraController>();
if(CameraController == null)
Debug.LogWarning("WARNING: OVRCameraController not found!");
// NOTE: MSAA TEXTURES NOT AVAILABLE YET
// Set CameraTextureScale (increases the size of the texture we are rendering into
// for a better pixel match when post processing the image through lens distortion)
#if MSAA_ENABLED
CameraTextureScale = OVRDevice.DistortionScale();
#endif
// If CameraTextureScale is not 1.0f, create a new texture and assign to target texture
// Otherwise, fall back to normal camera rendering
if((CameraTexture == null) && (CameraTextureScale > 1.0f))
{
int w = (int)(Screen.width / 2.0f * CameraTextureScale);
int h = (int)(Screen.height * CameraTextureScale);
CameraTexture = new RenderTexture( w, h, 24); // 24 bit colorspace
// NOTE: MSAA TEXTURES NOT AVAILABLE YET
// This value should be the default for MSAA textures
// CameraTexture.antiAliasing = 4;
// Set it within the project
#if MSAA_ENABLED
CameraTexture.antiAliasing = QualitySettings.antiAliasing;
#endif
}
}
示例14: Awake
// * * * * * * * * * * * * *
// Awake
public new virtual void Awake()
{
base.Awake();
// Don't let the Physics Engine rotate this physics object so it doesn't fall over when running
rigidbody.freezeRotation = true;
collider.material.dynamicFriction = 0;
collider.material.dynamicFriction2 = 0;
collider.material.staticFriction = 0;
collider.material.staticFriction2 = 0;
collider.material.frictionCombine = PhysicMaterialCombine.Minimum;
// We use OVRCameraController to set rotations to cameras,
// and to be influenced by rotation
OVRCameraController[] CameraControllers;
CameraControllers = gameObject.GetComponentsInChildren<OVRCameraController>();
if(CameraControllers.Length == 0)
Debug.LogWarning("OVRPlayerController: No OVRCameraController attached.");
else if (CameraControllers.Length > 1)
Debug.LogWarning("OVRPlayerController: More then 1 OVRCameraController attached.");
else
CameraController = CameraControllers[0];
// Instantiate a Transform from the main game object (will be used to
// direct the motion of the PlayerController, as well as used to rotate
// a visible body attached to the controller)
DirXform = null;
Transform[] Xforms = gameObject.GetComponentsInChildren<Transform>();
for(int i = 0; i < Xforms.Length; i++)
{
if(Xforms[i].name == "ForwardDirection")
{
DirXform = Xforms[i];
break;
}
}
if(DirXform == null)
Debug.LogWarning("OVRPlayerController: ForwardDirection game object not found. Do not use.");
}
示例15: Start
void Start()
{
controller = GetComponent<OVRCameraController>();
}