【发布时间】:2017-05-02 21:50:33
【问题描述】:
我目前正在制作 AR 纸牌游戏,您需要在游戏卡上选择一对相同的动画。 有 16 种不同的游戏卡,每张 2 都使用 Vuforia 投射相同的动画。 2张游戏卡可以同时追踪。如何比较正在跟踪的两张卡上的动画是否相同? 我是编码新手,但需要这样做。
public void OnTrackableStateChanged(TrackableBehaviour.Status previousStatus, TrackableBehaviour.Status newStatus)
{
if (newStatus == TrackableBehaviour.Status.DETECTED ||
newStatus == TrackableBehaviour.Status.TRACKED ||
newStatus == TrackableBehaviour.Status.EXTENDED_TRACKED)
{
activeTrackables = sm.GetActiveTrackableBehaviours ();
MatchCount.cardCount++;
if (MatchCount.cardCount == 2) { //if there are 2 tracked cards
//Compare them
if ( /* first projected animation */ == /* second projected animation */) {
MatchCount.matches--;
}
matchText.text = "number of matches: " + MatchCount.matches;
}
}
else
{
MatchCount.cardCount--;
if (MatchCount.cardCount < 0) {
MatchCount.cardCount = 0;
}
matchText.text = "number of matches: " + MatchCount.matches;
}
}
【问题讨论】:
-
首先您需要两个对象进行比较。在您的代码示例中,甚至没有一个,除非您正在谈论其中之一的当前
transform或gameobject。
标签: c# android unity3d vuforia