1
繼九段的SampleApp腳本:訪問九段事件,變量雖然另一個腳本
using UnityEngine;
using System.Collections;
namespace Kudan.AR.Samples
{
/// <summary>
/// Script used in the Kudan Samples. Provides functions that switch between different tracking methods and start abitrary tracking.
/// </summary>
public class SampleApp : MonoBehaviour
{
public KudanTracker _kudanTracker; // The tracker to be referenced in the inspector. This is the Kudan Camera object.
public TrackingMethodMarker _markerTracking; // The reference to the marker tracking method that lets the tracker know which method it is using
public TrackingMethodMarkerless _markerlessTracking; // The reference to the markerless tracking method that lets the tracker know which method it is using
public void MarkerClicked()
{
_kudanTracker.ChangeTrackingMethod(_markerTracking); // Change the current tracking method to marker tracking
}
public void MarkerlessClicked()
{
_kudanTracker.ChangeTrackingMethod(_markerlessTracking); // Change the current tracking method to markerless tracking
}
public void StartClicked()
{
// from the floor placer.
Vector3 floorPosition; // The current position in 3D space of the floor
Quaternion floorOrientation; // The current orientation of the floor in 3D space, relative to the device
_kudanTracker.FloorPlaceGetPose(out floorPosition, out floorOrientation); // Gets the position and orientation of the floor and assigns the referenced Vector3 and Quaternion those values
_kudanTracker.ArbiTrackStart(floorPosition, floorOrientation); // Starts markerless tracking based upon the given floor position and orientations
}
}
}
要訪問九段的功能/事件/變量,我需要使用九段相同的命名空間創建一個腳本。我不知道這可能會有什麼好處或壞處,因爲我不太瞭解命名空間。
我的問題是,我可以訪問這些變量/函數/等沒有使我的腳本在同一個命名空間?如果是這樣,怎麼樣?
我自己學習編程,所以如果這對某些人來說太基本了,我很抱歉,謝謝。
謝謝,這正是我需要的! – jFelipe