есть функция spawnArobject, которая запускает мою Ar-модель, но я хочу сделать 2 кнопки, которые дают разные 3D-модели для появления, как я могу сделать это, а также удалить кнопку после того, как она нажата, так что это делает ' Вмешательство в модель
public void _SpawnARObject()
{
Touch touch;
touch = Input.GetTouch(0);
Debug.Log("touch count is " + Input.touchCount);
TrackableHit hit; // Raycast against the location the player touched to search for planes.
TrackableHitFlags raycastFilter = TrackableHitFlags.PlaneWithinPolygon |
TrackableHitFlags.FeaturePointWithSurfaceNormal;
if (touch.phase == TouchPhase.Began)
{
Debug.Log("Touch Began");
if (Frame.Raycast(touch.position.x, touch.position.y, raycastFilter, out hit))
{
if (CurrentNumberOfGameObjects < numberOfGameObjectsAllowed)
{
Debug.Log("Screen Touched");
Destroy(ARObject);
// Use hit pose and camera pose to check if hittest is from the
// back of the plane, if it is, no need to create the anchor.
if ((hit.Trackable is DetectedPlane) &&
Vector3.Dot(FirstPersonCamera.transform.position - hit.Pose.position,
hit.Pose.rotation * Vector3.up) < 0)
{
Debug.Log("Hit at back of the current DetectedPlane");
}
else
{
ARObject = Instantiate(ARAndroidPrefab, hit.Pose.position, hit.Pose.rotation);// Instantiate Andy model at the hit pose.
ARObject.transform.Rotate(0, 0, 0, Space.Self);// Compensate for the hitPose rotation facing away from the raycast (i.e. camera).
var anchor = hit.Trackable.CreateAnchor(hit.Pose);
ARObject.transform.parent = anchor.transform;
CurrentNumberOfGameObjects = CurrentNumberOfGameObjects + 1;
// Hide Plane once ARObject is Instantiated
foreach (GameObject Temp in DetectedPlaneGenerator.instance.PLANES) //RK
{
Temp.SetActive(false);
}
}
}
}
}
https://github.com/reigngt09/ARCore/tree/master/J_VerticalPlaneDetection это ссылка для всего проекта, в который я хочу внести изменения в этом проекте. СПАСИБО ЗА ПРЕДЕЛА