gpt4 book ai didi

c# - Vuforia 一张图片定位多张图片

转载 作者:行者123 更新时间:2023-11-30 18:18:49 27 4
gpt4 key购买 nike

我学习增强现实,但遇到了问题。我想使用一个图像目标,但我有很多图片(在我的 vuforia 数据库中)。我只能阅读一张图片,但这对我来说是个问题。我必须扫描很多标记(我会读取不同的标记,但一个图像目标就足够了)

我必须理解这个图像名称并使用循环。我使用了互联网上的代码,但它们不起作用。

如何解决这个问题?

你能帮帮我吗?

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;

}

}

}

}

最佳答案

更改组件 Vuforia 行为中的 ARCamera 预制件选项:您需要的“最大同时跟踪图像”和“最大同时跟踪对象”。

enter image description here

关于c# - Vuforia 一张图片定位多张图片,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40480445/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com