1
0
forked from cgvr/DeltaVR

printer input hole animation

This commit is contained in:
2026-02-15 12:07:34 +02:00
parent 17c9122a14
commit 46400bc1f0
5 changed files with 171 additions and 111 deletions

View File

@@ -1,3 +1,4 @@
using FMOD.Studio;
using System;
using System.Collections;
using System.Collections.Generic;
@@ -9,12 +10,15 @@ public class Printer3D : MonoBehaviour
public int ignorePlayerCollisionLayer = 2;
public string shapeScannerTag = "ShapeScannable";
private bool isPrinting = false;
private EventInstance printingSound;
private GameObject GeneratedModel;
// Start is called before the first frame update
void Start()
{
printingSound = AudioManager.Instance.CreateInstance(FMODEvents.Instance.Printing);
printingSound.setParameterByName("3DPrinterPrintingJob", 1);
}
// Update is called once per frame
@@ -25,6 +29,10 @@ public class Printer3D : MonoBehaviour
public async void PrintObject(Texture2D texture)
{
isPrinting = true;
printingSound.start();
printingSound.setParameterByName("3DPrinterPrintingJob", 0);
string encodedTexture = Convert.ToBase64String(texture.EncodeToJPG());
byte[] encodedModel = await TrellisClient.Instance.GenerateModel(encodedTexture);
@@ -36,6 +44,9 @@ public class Printer3D : MonoBehaviour
GeneratedModel.transform.position = Vector3.zero;
}
GeneratedModel = spawnedObject;
printingSound.setParameterByName("3DPrinterPrintingJob", 1);
isPrinting = false;
}
private void InitializeSpawnedObject(GameObject spawnedObject)
@@ -59,4 +70,9 @@ public class Printer3D : MonoBehaviour
spawnedObjectParent.AddComponent<TwoHandScaleGrabInteractable>();
}
public bool IsPrinting()
{
return isPrinting;
}
}