Log in or register to post comments

Creating elements relativ to the Camera in Unity

November 4, 2014 - 9:20am #1

Hi there,

 

I want to be able to create elements that are not affected by the Movement of the AR Camera and stay at the same position on the screen on each frame.

It doesn't matter if elements are child of ImageTarget or not, they are moved anyway if a trackable is scanned. 

I already tried to add a script to the elment that should be "attached" to the cam: 

something like 

transform.position = Camera.main.ViewportToWorldPoint(new Vector3(0,1,0));

or 

transform.position = Camera.main.ScreenToWorldPoint(new Vector3(15Screen.height - 5010));

 

but that doesnt work. I need to have a Transform for the Element so I can create something like a HUD and that is connected with a LineRenderer to the ImageTarget so that the line is connected to the target at all times.

 

Thanks for your help.

Creating elements relativ to the Camera in Unity

November 6, 2014 - 4:05pm #2

You might be interested to check out the Books sample app which demonstrates the technique of moving objects from world space to camera space.

Log in or register to post comments