本文整理汇总了C#中OVRCameraController类的典型用法代码示例。如果您正苦于以下问题:C# OVRCameraController类的具体用法?C# OVRCameraController怎么用?C# OVRCameraController使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OVRCameraController类属于命名空间,在下文中一共展示了OVRCameraController类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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");
}
}
开发者ID:AjayTalati,项目名称:BCI_Experiments,代码行数:32,代码来源:PlayerScript.cs
示例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;
}
开发者ID:JungleJinn,项目名称:exile-metalgearcloset,代码行数:11,代码来源:CoatHide.cs
示例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;
}
}
开发者ID:guozanhua,项目名称:kinect-oculus-demo,代码行数:13,代码来源:OVRCrosshair.cs
示例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];
}
开发者ID:jceipek,项目名称:Equilibrium,代码行数:13,代码来源:ThreeDimGUI.cs
示例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 );
}
开发者ID:Tamulur,项目名称:AvatarExperiments,代码行数:14,代码来源:PossessionController.cs
示例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>();
}
开发者ID:WozStudios,项目名称:AVirtualWonderland,代码行数:15,代码来源:Player.cs
示例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];
}
开发者ID:Zerophase,项目名称:SplitAlphaBuild,代码行数:16,代码来源:Controller.cs
示例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];
}
}
开发者ID:sohailmehra7,项目名称:Free-Gilly,代码行数:18,代码来源:HUDScript.cs
示例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.");
}
开发者ID:jreidy,项目名称:CS248_Final_Project,代码行数:40,代码来源:NetworkOVRPlayerController.cs
示例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>();
}
开发者ID:rpalcode,项目名称:robot-intentions,代码行数:15,代码来源:scene5.cs
示例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;
}
开发者ID:xianyinchen,项目名称:Demos,代码行数:24,代码来源:OVRDistortionCamera.cs
示例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);
}
开发者ID:xianyinchen,项目名称:Demos,代码行数:9,代码来源:OVRCrosshair.cs
示例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
}
}
开发者ID:johhov,项目名称:DeviceJam,代码行数:34,代码来源:OVRCamera.cs
示例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.");
}
开发者ID:ninacpark,项目名称:EtherealRobot,代码行数:45,代码来源:NoFrictionPC.cs
示例15: Start
void Start()
{
controller = GetComponent<OVRCameraController>();
}
开发者ID:BigRobCoder,项目名称:VirtualWorldLink,代码行数:4,代码来源:VWLEntrance.cs
示例16: OnEnable
// OnEnable
void OnEnable()
{
m_Component = (OVRCameraController)target;
}
开发者ID:JulieHeyde,项目名称:RiftGesture,代码行数:5,代码来源:OVRCameraControllerEditor.cs
示例17: Awake
// * * * * * * * * * * * * *
// Awake
void Awake()
{
OVRCameraController[] CameraControllers;
CameraControllers = gameObject.GetComponentsInChildren<OVRCameraController>();
if(CameraControllers.Length == 0)
Debug.LogWarning("No OVRCameraController attached.");
else if (CameraControllers.Length > 1)
Debug.LogWarning("More then 1 OVRCameraController attached.");
else
CameraController = CameraControllers[0];
}
开发者ID:CuriosityAtHome,项目名称:AppChallenge,代码行数:14,代码来源:OVRMainMenu.cs
示例18: Start
/// <summary>
/// Start
/// </summary>
new void Start()
{
base.Start ();
// Get the OVRCameraController
CameraController = gameObject.transform.parent.GetComponent<OVRCameraController>();
if(CameraController == null)
Debug.LogWarning("WARNING: OVRCameraController not found!");
// 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 CameraTextureScale is not 1.0f, create a new texture and assign to target texture
// Otherwise, fall back to normal camera rendering
int w = 0;
int h = 0;
GetIdealResolution(ref w, ref h);
int index = (RightEye) ? 1 : 0;
if ( GetComponent<Camera>().hdr )
CameraTexture[index] = new RenderTexture( w, h, 24, RenderTextureFormat.ARGBFloat );
else
CameraTexture[index] = new RenderTexture(w, h, 24);
// Use MSAA settings in QualitySettings for new RenderTexture
CameraTexture[index].antiAliasing = (QualitySettings.antiAliasing == 0) ? 1 : QualitySettings.antiAliasing;
GetComponent<Camera>().targetTexture = CameraTexture[index];
}
开发者ID:VRWizards,项目名称:VR-Project,代码行数:33,代码来源:OVRCamera.cs
示例19: Awake
// End of Yaw Drift Corrector members
void Awake()
{
localPosition = Vector3.zero;
localRotation = Quaternion.identity;
rawRotation = Quaternion.identity;
filterPos = new KalmanFilter();
filterPos.initialize(3,3);
filterPos.skipIdenticalMeasurements = true;
// filterRot = new KalmanFilter();
// filterRot.initialize(4,4);
// Mobile Razer Hydra base filtering
hydraBaseFilterPos = new KalmanFilter();
hydraBaseFilterPos.initialize(3,3);
hydraBaseFilterPos.skipIdenticalMeasurements = true;
// hydraBaseFilterRot = new KalmanFilter();
// hydraBaseFilterRot.initialize(4,4);
filterRot.skipIdenticalMeasurements = true;
// Yaw Drift Corrector invocations in Awake()
filterDrift = new KalmanFilter();
filterDrift.initialize(2,2);
transform.localPosition = defaultPosition;
eyeCenterPosition = defaultPosition;
measuredHeadPosition = defaultPosition;
hydraBasePosition = new Vector3(0, 0, 0);
hydraBaseRotation = Quaternion.identity;
oculusCamController = gameObject.GetComponentInChildren(typeof(OVRCameraController)) as OVRCameraController;
if(oculusCamController)
{
useOculusRiftRotation = true;
}
else
{
useOculusRiftRotation = false;
}
//oculusCamController = FindObjectOfType(typeof(OVRCameraController)) as OVRCameraController;
//if(headRotationInput == HeadRotationSource.OculusRift && !oculusCamController)
// Debug.LogError("OVRCameraController script is missing from this scene!");
filterPosition = false;
}
开发者ID:Zerphed,项目名称:miscellaneous,代码行数:49,代码来源:RUISTracker.cs
示例20: Start
// Use this for initialization
void Start()
{
// Set the GUI target
GUIRenderObject = GameObject.Instantiate(Resources.Load("OVRGUIObjectMain")) as GameObject;
// Find camera controller
OVRCameraController[] CameraControllers;
CameraControllers = FindObjectsOfType(typeof(OVRCameraController)) as 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];
if(GUIRenderObject != null)
{
if(GUIRenderTexture == null) // TODO: *** Screen.width from RUISDisplayManager
{
int w = Screen.width;
int h = Screen.height;
if(CameraController != null && CameraController.PortraitMode == true)
{
int t = h;
h = w;
w = t;
}
GUIRenderTexture = new RenderTexture(w, h, 24);
GuiHelper.SetPixelResolution(w, h);
GuiHelper.SetDisplayResolution(OVRDevice.HResolution, OVRDevice.VResolution);
}
}
// Attach GUI texture to GUI object and GUI object to Camera
if(GUIRenderTexture != null && GUIRenderObject != null)
{
GUIRenderObject.renderer.material.mainTexture = GUIRenderTexture;
if(CameraController != null)
{
// Grab transform of GUI object
Transform t = GUIRenderObject.transform;
// Attach the GUI object to the camera
CameraController.AttachGameObjectToCamera(ref GUIRenderObject);
// Reset the transform values (we will be maintaining state of the GUI object
// in local state)
OVRUtils.SetLocalTransform(ref GUIRenderObject, ref t);
// Deactivate object until we have completed the fade-in
// Also, we may want to deactive the render object if there is nothing being rendered
// into the UI
// we will move the position of everything over to the left, so get
// IPD / 2 and position camera towards negative X
Vector3 lp = GUIRenderObject.transform.localPosition;
float ipd = 0.0f;
CameraController.GetIPD(ref ipd);
lp.x -= ipd * 0.5f;
GUIRenderObject.transform.localPosition = lp;
GUIRenderObject.SetActive(false);
}
}
// Mag Yaw-Drift correction
if(CameraController != null)
{
magCal.SetOVRCameraController(ref CameraController);
magCal.SetInitialCalibarationState();
}
// Show Oculus magnetometer status at the beginning
if(showCalibrationStatus && OVRDevice.IsSensorPresent(0))
{
delayedShowTime = delayedShowDuration;
showMagStatus = true;
}
}
开发者ID:Zerphed,项目名称:miscellaneous,代码行数:80,代码来源:RUISOculusHUD.cs
注:本文中的OVRCameraController类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论