我正在开发增强现实应用程序。我想在应用程序中放入多个图像目标 e 多个 3D 模型,将特定图像目标与特定 3D 模型连接起来。为此,我想使用assetbundle 将3D 模型存储在服务器中,并使用cloudrecognition 来存储图像目标。我在这方面遇到了一些困难。更好的方法是什么?我什至无法将 3D 模型(在assetBundle 中)连接到普通图像目标中,如何将其连接到云中的图像目标?
问问题
968 次
2 回答
1
我使用附在 cloudreco 上的这个脚本:
using Vuforia;
using UnityEngine;
public class SimpleCloudHandler : MonoBehaviour, ICloudRecoEventHandler
{
private CloudRecoBehaviour mCloudRecoBehaviour;
private bool mIsScanning = false;
private string mTargetMetadata = "";
// Use this for initialization
void Start()
{
// register this event handler at the cloud reco behaviour
mCloudRecoBehaviour = GetComponent<CloudRecoBehaviour>();
if (mCloudRecoBehaviour)
{
mCloudRecoBehaviour.RegisterEventHandler(this);
}
}
public void OnInitialized()
{
Debug.Log("Cloud Reco initialized");
}
public void OnInitError(TargetFinder.InitState initError)
{
Debug.Log("Cloud Reco init error " + initError.ToString());
}
public void OnUpdateError(TargetFinder.UpdateState updateError)
{
Debug.Log("Cloud Reco update error " + updateError.ToString());
}
public void OnStateChanged(bool scanning)
{
mIsScanning = scanning;
if (scanning)
{
// clear all known trackables
var tracker = TrackerManager.Instance.GetTracker<ObjectTracker>();
tracker.TargetFinder.ClearTrackables(false);
}
}
// Here we handle a cloud target recognition event
public void OnNewSearchResult(TargetFinder.TargetSearchResult targetSearchResult)
{
// do something with the target metadata
NewMethod(targetSearchResult);
// stop the target finder (i.e. stop scanning the cloud)
mCloudRecoBehaviour.CloudRecoEnabled = false;
}
private void NewMethod(TargetFinder.TargetSearchResult targetSearchResult)
{
mTargetMetadata = targetSearchResult.MetaData;
}
void OnGUI()
{
// Display current 'scanning' status
GUI.Box(new Rect(100, 100, 200, 50), mIsScanning ? "Scanning" : "Not scanning");
// Display metadata of latest detected cloud-target
GUI.Box(new Rect(100, 200, 200, 50), "Metadata: " + mTargetMetadata);
// If not scanning, show button
// so that user can restart cloud scanning
if (!mIsScanning)
{
if (GUI.Button(new Rect(100, 300, 200, 50), "Restart Scanning"))
{
// Restart TargetFinder
mCloudRecoBehaviour.CloudRecoEnabled = true;
}
}
}
}
并出现此消息:我们有一个目标元数据:https ://drive.google.com/uc?authuser=0&id=1twVZENr-J9gsw4PwLeelA1quAIgxsLUN&export= download UnityEngine.Debug:Log(Object) SimpleCloudHandler:OnNewSearchResult(TargetSearchResult)(在 Assets/ SimpleCloudHandler.cs:49) Vuforia.CloudRecoBehaviour:Update()
于 2018-05-21T21:18:44.983 回答
0
1) https://library.vuforia.com/articles/Training/Cloud-Recognition-Guide.html#metadata
通过此链接,仍然无法发布您的脚本或错误。
于 2018-05-19T05:41:08.067 回答