Forum Discussion
Metagen
12 years agoHonored Guest
Oculus Distorts Raycast
So essentially I'm creating an on-rails first person shooter using the Oculus and Leap Motion. Adding the Oculus causes the raycast that controls the hit detection to veer off target. I've found a c...
Metagen
12 years agoHonored Guest
Okay, so I've progressed to the point where I'm sure that it's at least tracking my hand movements mostly correctly. However, the raycast doesn't seem to be following the camera's movements exactly as it should and there also still seems to be some sort of distortion in that straight up and down movement seems to cause a curve as well as being off-center to the sides. Even the Debug.DrawRay doesn't seem to be matching up with where the hit markers appear.
Honestly, I'm absolutely stumped by this :oops:
Vector normalizedPosition = iBox.NormalizePoint(handCenter);
float x = normalizedPosition.x;
float y = normalizedPosition.y;
float z = normalizedPosition.z;
Vector3 cameraPos = transform.position;
Vector3 cameraDir = transform.forward;
Vector3 cursorPos = new Vector3(x,y,z);
Vector3 direction = cameraDir + cursorPos;
//denormalize
float directionx = direction.x * screenWidth;
float directiony = direction.y * screenHeight;
float directionz = direction.z * screenWidth;
Vector3 rayDirection = new Vector3(directionx,directiony,directionz);
if (Physics.Raycast (cameraPos, rayDirection, out hit, Range)){
}
Honestly, I'm absolutely stumped by this :oops:
Quick Links
- Horizon Developer Support
- Quest User Forums
- Troubleshooting Forum for problems with a game or app
- Quest Support for problems with your device
Other Meta Support
Related Content
- 15 days ago