unity3d - Unity - move 3d object in an AR scene -


i have ar scene has 1 ar camera, image target , 3d object below as. enter image description here

i create .cs file , attach arcamera. want move ar object mouse click position. tried many codes this. couldn't success it. know input.mouseposition returns screen position. convert screentoworldposition , put 3d object on position. 3d object moved, not mouse click position. don't know moved.

how can move mouse click position? code here :

camera cam; vector3 target = new vector3(0.0f, 10f,0.5f); // use initialization void start () {     if (cam == null)         cam = camera.main; } void update() {     if (input.getmousebuttondown(0)) {         debug.log("mousedown");          vector3 mousepos = input.mouseposition;         mousepos = cam.screentoworldpoint(mousepos);         gameobject.find("car1").gameobject.transform.position = mousepos;     }                                                                 } 

edit 1 if add plane scene, can move position of mouse click on plane. code taken here. plane prevents show ar camera view. screenshot below:

enter image description here

instead of playing screentoworldpoint, should use raycast against plane, see answer: https://stackoverflow.com/a/29754194/785171.

the plane should attached ar marker.


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -