StereoTargetEye TargetEye { get; set; }

book_4_sparkGenerated
code_blocksInput

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 separately 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 camera's view 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, depending on your rendering requirements.

For example, if you want to render the scene for the left eye of an HMD, you would set the property as follows:

Example

SceneCamera camera = new SceneCamera();
camera.TargetEye = StereoTargetEye.Left; // Set the camera to target the left eye of the HMD

// To render to the user's monitor instead, use:
camera.TargetEye = StereoTargetEye.None;