forked from cgvr/DeltaVR
53 lines
1.5 KiB
C#
53 lines
1.5 KiB
C#
using UnityEngine;
|
|
|
|
public class ModelGenerationTestBox : MonoBehaviour
|
|
{
|
|
public Material activeMaterial;
|
|
public Material inactiveMaterial;
|
|
public Transform modelSpawnPoint;
|
|
public VoiceTranscriptionTestBox voiceTranscriptionTestBox;
|
|
|
|
private MeshRenderer meshRenderer;
|
|
|
|
|
|
// Start is called before the first frame update
|
|
void Start()
|
|
{
|
|
meshRenderer = GetComponent<MeshRenderer>();
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
|
|
}
|
|
|
|
async void OnTriggerEnter(Collider other)
|
|
{
|
|
KbmController controller = other.GetComponent<KbmController>();
|
|
if (controller != null)
|
|
{
|
|
meshRenderer.material = activeMaterial;
|
|
|
|
string inputPrompt = voiceTranscriptionTestBox.currentTextOutput;
|
|
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;
|
|
}
|
|
}
|
|
|
|
private void OnTriggerExit(Collider other)
|
|
{
|
|
KbmController controller = other.GetComponent<KbmController>();
|
|
if (controller != null)
|
|
{
|
|
meshRenderer.material = inactiveMaterial;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|