forked from cgvr/DeltaVR
printer spawns object in correct place, size, and plays sound
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
using FMOD.Studio;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class Printer3D : MonoBehaviour
|
||||
@@ -9,6 +7,7 @@ public class Printer3D : MonoBehaviour
|
||||
public Transform spawnPoint;
|
||||
public int ignorePlayerCollisionLayer = 2;
|
||||
public string shapeScannerTag = "ShapeScannable";
|
||||
public float printedObjectSize = 0.5f;
|
||||
|
||||
private bool isPrinting = false;
|
||||
private EventInstance printingSound;
|
||||
@@ -19,6 +18,8 @@ public class Printer3D : MonoBehaviour
|
||||
{
|
||||
printingSound = AudioManager.Instance.CreateInstance(FMODEvents.Instance.Printing);
|
||||
printingSound.setParameterByName("3DPrinterPrintingJob", 1);
|
||||
printingSound.setParameterByName("Occlusion", 0);
|
||||
printingSound.set3DAttributes(FMODUnity.RuntimeUtils.To3DAttributes(spawnPoint));
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
@@ -36,7 +37,7 @@ public class Printer3D : MonoBehaviour
|
||||
string encodedTexture = Convert.ToBase64String(texture.EncodeToJPG());
|
||||
byte[] encodedModel = await TrellisClient.Instance.GenerateModel(encodedTexture);
|
||||
|
||||
GameObject spawnedObject = await ModelGenerationUtils.Instance.SpawnModel(encodedModel);
|
||||
GameObject spawnedObject = await ModelGenerationUtils.Instance.SpawnModel(encodedModel, printedObjectSize);
|
||||
InitializeSpawnedObject(spawnedObject);
|
||||
if (GeneratedModel != null)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user