Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
ARManager arManagr = FindObjectOfType<ARManager>();
if (arManagr == null)
{
Debug.LogError("Can't find ARManager. You need to add ARManager prefab in scene.");
return;
}
else
{
arCamera = arManagr.gameObject;
}
vPSStudioController = FindObjectOfType<VPSStudioController>();
if (vPSStudioController == null)
{
Debug.LogError("Can't find VPSStudioController. You need to add VPSStudio prefab in scene.");
return;
}
else
{
string serverName = vPSStudioController.vpsServerName;
vPSStudioController.gameObject.SetActive(false);
}
cameraBackgroundBehaviour = FindObjectOfType<CameraBackgroundBehaviour>();
if (cameraBackgroundBehaviour == null)
{
Debug.LogError("Can't find CameraBackgroundBehaviour.");
return;
}
if(rootTrackable == null)
{
Debug.LogError("You need to add RootTrackable.");
}foreach (GameObject eachGameObject in occlusionObjects)
{
Renderer[] cullingRenderer = eachGameObject.GetComponentsInChildren<Renderer>();
foreach (Renderer eachRenderer in cullingRenderer)
{
eachRenderer.material.renderQueue = 1900;
eachRenderer.material = runtimeBuildingMaterial;
}
}if (Application.platform == RuntimePlatform.OSXEditor || Application.platform == RuntimePlatform.WindowsEditor)
{
string simulatePath = vPSStudioController.vpsSimulatePath;
if (Directory.Exists(simulatePath))
{
CameraDevice.GetInstance().Start(simulatePath);
MaxstAR.SetScreenOrientation((int)ScreenOrientation.Portrait);
}
}
else
{
if (CameraDevice.GetInstance().IsFusionSupported(CameraDevice.FusionType.ARCamera))
{
CameraDevice.GetInstance().Start();
}
else
{
TrackerManager.GetInstance().RequestARCoreApk();
}
}
TrackerManager.GetInstance().StartTracker();
if (serverName != "")
{
string vpsquery = "{\"vps_server\":\"" + serverName + "\"}";
TrackerManager.GetInstance().AddTrackerData(vpsquery);
}void Update()
{
TrackerManager.GetInstance().UpdateFrame();
ARFrame arFrame = TrackerManager.GetInstance().GetARFrame();
TrackedImage trackedImage = arFrame.GetTrackedImage();
if (trackedImage.IsTextureId())
{
IntPtr[] cameraTextureIds = trackedImage.GetTextureIds();
cameraBackgroundBehaviour.UpdateCameraBackgroundImage(cameraTextureIds);
}
else
{
cameraBackgroundBehaviour.UpdateCameraBackgroundImage(trackedImage);
}
if(arFrame.GetARLocationRecognizeState() == ARLocationRecognizeState.ARLocationRecognizeStateNormal)
{
Matrix4x4 targetPose = arFrame.GetTransform();
arCamera.transform.position = MatrixUtils.PositionFromMatrix(targetPose);
arCamera.transform.rotation = MatrixUtils.QuaternionFromMatrix(targetPose);
arCamera.transform.localScale = MatrixUtils.ScaleFromMatrix(targetPose);
rootTrackable.SetActive(true);
}
else
{
rootTrackable.SetActive(false);
}
}Easily place rendered 3D Object in UnitySceneView and precisely arrange its positioning via simulation using reference camera
public void OnClickNavigation()
{
NavigationController navigationController = vPSStudioController.GetComponent<NavigationController>();
navigationController.MakePath(arCamera.transform.position, new Vector3(77.975977f, 0, 71.859565f), serverName);
}The type or namespace name 'EditorCoroutines' does not exist in the namespace ‘Unity'. 






API Reference Link
public void AttachLogo()
{
Vector2 vTouchPos = Input.mousePosition;
Ray ray = Camera.main.ScreenPointToRay(vTouchPos);
RaycastHit vHit;
if (Physics.Raycast(ray.origin, ray.direction, out vHit))
{
maxstLogObject.transform.position = vHit.point;
maxstLogObject.transform.rotation = Quaternion.FromToRotation(Vector3.forward, vHit.normal) * Quaternion.Euler(-90.0f ,0.0f, 0.0f);
}
}nRCollectYUV = new NRCollectYUV();
nRCollectYUV.Play();
TrackerManager.GetInstance().StartTracker();
if (serverName != "")
{
string vpsquery = "{\"vps_server\":\"" + serverName + "\"}";
TrackerManager.GetInstance().AddTrackerData(vpsquery);
}void Update()
{
TrackerManager.GetInstance().UpdateFrame();
nRCollectYUV.UpdateFrame();
var eyePoseFromHead = NRFrame.EyePoseFromHead;
Matrix4x4 Mhe = MatrixUtils.ConvertPoseToMatrix4x4(eyePoseFromHead.RGBEyePos);
ARFrame arFrame = TrackerManager.GetInstance().GetARFrame();
if (arFrame.GetARLocationRecognizeState() == ARLocationRecognizeState.ARLocationRecognizeStateNormal)
{
Matrix4x4 targetPose = arFrame.GetTransform(Mhe);
arCamera.transform.position = MatrixUtils.PositionFromMatrix(targetPose);
arCamera.transform.rotation = MatrixUtils.QuaternionFromMatrix(targetPose);
arCamera.transform.localScale = MatrixUtils.ScaleFromMatrix(targetPose);
rootTrackable.SetActive(true);
}
else
{
rootTrackable.SetActive(false);
}
}






