c# - Problems with Raycast for ARCamera in Unity3d with Vuforia SDK -


i new vuforia.

the gameobject script added, 3d object made visible on user-defined triggered image.

i know not new question , have gone through each of thread/post on official vuforia discussion blog matter problem still persists. , problem seems fundamental.

i have following script attached gameobject :

void update ()  {     if (input.touchcount == 1)      {         // touches performed on screen         ray ray;         raycasthit hit;         debug.log ("2");         if(camera.main != null)         {             debug.log ("3");             ray = camera.main.screenpointtoray(input.gettouch(0).position);             hit = new raycasthit();             debug.log ("33");             if(physics.raycast(ray, out hit))             {                 debug.log ("4");             }                    }             }     } 

when run scene , touch on gameobject, debug console shows

2

3

33

but not 4. somehow ray doesn't hit object.

this script works fine normal camera. please shed light on this.

thanks

(as far can tell) vuforia doesn't use arcamera collision detection. instead there 'background camera' (you can see if run app in unity , pause it; you'll find in hierarchy pane). access use

camera.allcameras[0]  

instead of

camera.main 

hope helps


Comments

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -