Hi Vuforia Team,
I am following a GPS based application which evolves around GeoLocation get Coordinates logic.I want a markerless AR app which keeps a base 3D object fixed to the position wherever It is when app started to load and hat obect must not change it's position in relation wit AR Camera.
Platform Details I am using:
Inmy application I am uig an UFO obj hanging above at fixed position in the Unity Application.
Required functionality:the UFO must be static at the position wherever it appears on First loading of the AR scene.But THe UFO is not fixed to the initial position and it follows the camera like a faithul puppy.
Solution Folloed:I know some Unity logic to make an object independant of camera.
1.find the OBJECT_INITIAL_POSITION in awake or start function.
2.find the WORLD_DISTACE_FROM_CAMERA_TO_OBJECT_INITIAL in awake or start function.
2.In the upadte function find the WORLD_DISTACE_FROM_CAMERA_TO_OBJECT_RECENT.
3.Then shift object transform position by the differnce of these two values.
//in variable declaration
private Camera m_CameraMAIN;
private Vector3 object_initial_position;
private Vector3 distance_from_camera_to_object_initial;
private Vector3 distance_from_camera_to_object_updated;
//in start function
m_CameraMAIN = Camera.main;
object_initial_position = transform.position;
distance_from_camera_to_object_initial = m_CameraMAIN.WorldToScreenPoint(object_initial_position);
//in update function
distance_from_camera_to_object_updated = m_CameraMAIN.WorldToScreenPoint(transform.position);
Vector3 diffDistance = distance_from_camera_to_object_updated - distance_from_camera_to_object_initial;
transform.position = object_initial_position+diffDistance;
I know It is a bug in logic using WorldToScreenPoint on current position and shifting the same.And as expecte The object is lost.
But I am unable to try better solution for now as I am not fully introduced into Unity/Vuforia platforms.If any one of the exerienced programmers do it and share I am very happy to integrate it.
Thanks in Advance.