Description
The TargetEye
property of the SceneCamera
class specifies which eye of a head-mounted display (HMD) the camera is targeting. This is particularly useful in virtual reality applications where rendering for each eye is necessary to create a stereoscopic 3D effect. By setting this property, you can control whether the camera's output is directed to the left eye, right eye, or both. Additionally, you can set it to StereoTargetEye.None
to render the output to the user's monitor, often referred to as the companion window.
Usage
To use the TargetEye
property, you need to have an instance of SceneCamera
. You can then set the property to one of the values defined in the StereoTargetEye
enumeration, such as StereoTargetEye.Left
, StereoTargetEye.Right
, or StereoTargetEye.Both
. This will determine which eye the camera's view is rendered to in a VR setup.
Example
// Example of setting the TargetEye property
SceneCamera camera = new SceneCamera();
// Set the camera to render to the left eye of the HMD
camera.TargetEye = StereoTargetEye.Left;
// Set the camera to render to the right eye of the HMD
camera.TargetEye = StereoTargetEye.Right;
// Set the camera to render to both eyes
camera.TargetEye = StereoTargetEye.Both;
// Set the camera to render to the user's monitor (companion window)
camera.TargetEye = StereoTargetEye.None;