1
0
forked from cgvr/DeltaVR

add particle effects to 3d printer

This commit is contained in:
2026-03-07 11:59:46 +02:00
parent 96b21d0df9
commit f1fc906ae5
6 changed files with 4848 additions and 14 deletions

View File

@@ -11,6 +11,7 @@ public class Printer3D : MonoBehaviour
private bool isPrinting = false;
private EventInstance printingSound;
private ParticleSystem.EmissionModule particleEmission;
// Start is called before the first frame update
void Start()
@@ -19,6 +20,9 @@ public class Printer3D : MonoBehaviour
printingSound.setParameterByName("3DPrinterPrintingJob", 1);
printingSound.setParameterByName("Occlusion", 0);
printingSound.set3DAttributes(FMODUnity.RuntimeUtils.To3DAttributes(spawnPoint));
particleEmission = GetComponentInChildren<ParticleSystem>().emission;
particleEmission.enabled = false;
}
// Update is called once per frame
@@ -32,6 +36,7 @@ public class Printer3D : MonoBehaviour
isPrinting = true;
printingSound.start();
printingSound.setParameterByName("3DPrinterPrintingJob", 0);
particleEmission.enabled = true;
string encodedTexture = Convert.ToBase64String(texture.EncodeToJPG());
byte[] encodedModel = await TrellisClient.Instance.GenerateModel(encodedTexture);
@@ -40,6 +45,7 @@ public class Printer3D : MonoBehaviour
InitializeSpawnedObject(spawnedObject);
printingSound.setParameterByName("3DPrinterPrintingJob", 1);
particleEmission.enabled = false;
isPrinting = false;
}