Hey guys, we are having a bit of trouble raycasting against an AR camera at the moment.
The problem stems from the fact you fudge the gl viewport in TrackerBehaviour.cs
// Sets the viewport right before Unity renders 3D content. void OnPreRender() { // Don't set the viewport when running in the editor: if (!Application.isEditor) { GL.Viewport(mViewportRect); } }
Obviously this throws out all the camera based ray functions as they cannot take into account this viewport fudge.
public Ray ScreenPointToRay(Vector3 position); public Vector3 ScreenToViewportPoint(Vector3 position); public Vector3 ScreenToWorldPoint(Vector3 position); public Ray ViewportPointToRay(Vector3 position); public Vector3 ViewportToScreenPoint(Vector3 position); public Vector3 ViewportToWorldPoint(Vector3 position); public Vector3 WorldToScreenPoint(Vector3 position); public Vector3 WorldToViewportPoint(Vector3 position);
Ideally the viewport fudge would be done with Camera.rect, but we haven't found a way of replicating it yet.
Any ideas how we do accurate ray casts against an AR Camera?
Thanks
Dan
Hello all,
I have attached the below code to the AR Camera as to detect the different augmentations and drag them using touch input.
This piece of code works fine with default camera but with the AR Camera and touch input, this doesn't seem to work.
Also I have a specific doubt. The AR Camera prefab that comes with Vuforia has a child camera tagged by default as Main Camera.
So being a newbie to Unity and Vuforia, I am not able to figure out to which of these should i attach my codes. I have tried changing the layer of AR Camera, its child and the objects on the scene to a separate layer(eg layer 10). but it doesnt seem to work too
Hoping to receive some inputs.