using Unity.XR.CoreUtils; using UnityEngine; public class ModelGenerationTestBox : MonoBehaviour { public Material inactiveMaterial; public Material loadingMaterial; public Transform modelSpawnPoint; public VoiceTranscriptionTestBox voiceTranscriptionTestBox; private MeshRenderer meshRenderer; private bool isLoading; // Start is called before the first frame update void Start() { meshRenderer = GetComponent(); } // Update is called once per frame void Update() { } async void OnTriggerEnter(Collider other) { if (isLoading) return; KbmController controller = other.GetComponent(); XROrigin playerOrigin = other.GetComponent(); if (controller != null || playerOrigin != null) { string inputPrompt = voiceTranscriptionTestBox.currentTextOutput; isLoading = true; meshRenderer.material = loadingMaterial; string modelPath = await PipelineManager.Instance.GenerateModelAsync(inputPrompt); //LoadModel("D:\\henrisel\\DeltaVR3DModelGeneration\\3d-generation-pipeline\\models\\2025-11-17-16-13-33\\mesh.glb"); GameObject spawnedObject = await PipelineManager.Instance.SpawnModel(modelPath); spawnedObject.transform.parent = modelSpawnPoint; spawnedObject.transform.position = modelSpawnPoint.position; isLoading = false; meshRenderer.material = inactiveMaterial; } } }