2
我學習增強現實,並有問題。我想使用一個圖像目標,但我有很多圖片(在我的vuforia
數據庫中)。我只能閱讀一張圖片,但這對我來說是個問題。我必須掃描大量的標記(我會讀不同的標記,但一個圖像足夠的目標)Vuforia一個圖像目標很多圖片
我必須感知這個圖像名稱並使用循環。我在互聯網上使用代碼,但他們不工作。
如何解決這個問題?
你能幫助我嗎?在ARCamera預製
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using Vuforia;
public class DynamicTargets : MonoBehaviour
{
private bool mChipsObjectCreated = false;
// Update is called once per frame
void Update()
{
// mChipsObjectCreated = false;
IEnumerable<TrackableBehaviour> trackableBehaviours = TrackerManager.Instance.GetStateManager().GetActiveTrackableBehaviours();
// Loop over all TrackableBehaviours.
foreach (TrackableBehaviour trackableBehaviour in trackableBehaviours)
{
string name = trackableBehaviour.TrackableName;
Debug.Log("Trackable name: " + name);
while (name.Equals("photo") && !mChipsObjectCreated)
{
// chips target detected for the first time
// augmentation object has not yet been created for this target
// let's create it
GameObject cube = GameObject.CreatePrimitive(PrimitiveType.Cube);
// attach cube under target
cube.transform.parent = trackableBehaviour.transform;
// Add a Trackable event handler to the Trackable.
// This Behaviour handles Trackable lost/found callbacks.
trackableBehaviour.gameObject.AddComponent<DefaultTrackableEventHandler>();
// set local transformation (i.e. relative to the parent target)
cube.transform.localPosition = new Vector3(0, 0.2f, 0);
cube.transform.localScale = new Vector3(0.5f, 0.5f, 0.5f);
cube.transform.localRotation = Quaternion.identity;
cube.gameObject.SetActive(true);
mChipsObjectCreated = true;
}
}
}
}
據我所知,你需要每個圖像的差異圖像目標 – bpgeck