- Home /
Get Sight Line for VR User
I'm using Unity 5.1.2f and the "Virtual Reality Supported" setting, with a FPSController
prefab for my player and an Oculus Rift DK2 with runtime/sdk 6.0.1.
I want to obtain a ray that represents the player's line of sight.
My code looks like:
public GameObject camera; // linked to FirstPersonCharacter via Unity drag+drop
void Update()
{
Debug.DrawRay(camera.transform.position, camera.transform.forward);
}
The Debug ray is visible in the scene editor, but doesn't move when I look around with the headset. If I look around with the mouse (including vertically), the Debug ray follows the mouse movements. What's going on?
Workaround
If I enable mouse move smoothing on the FPSController, the drawn ray follows the headset as expected.
Your answer
Follow this Question
Related Questions
How to open the resources from a downloaded game to add another viewpoint? 0 Answers
Virtual Reality VR Camera 0 Answers
XR Second Camera Independent Aspect Ratio 0 Answers
CAVEs, OpenGL stereoscopy and camera frustrums 1 Answer
How to make a split screen, one for a main camera and one for the VR set camera? 1 Answer