1
0
forked from cgvr/DeltaVR

fixed bug with shape scanner destroying not whole scannable object, deleted Parent-GeneratedModel objects from scene

This commit is contained in:
2026-03-16 12:04:03 +02:00
parent db60947749
commit 2c8c146a5f
6 changed files with 16 additions and 13 deletions

View File

@@ -1,7 +1,6 @@
### TODO ### TODO
* teha build kus archery range'is spawnitud objektid * teha build kus archery range'is spawnitud objektid
* FMOD ChannelControl errorid * FMOD ChannelControl errorid
* glTF-StableFramerate, Parent-GeneratedModel eemaldada?
* speech-to-text: * speech-to-text:
* uurida miks buildis Whisper halvemini töötab * uurida miks buildis Whisper halvemini töötab
* proovida suuremat Whisperi mudelit, äkki töötab mürases keskkonnas paremini * proovida suuremat Whisperi mudelit, äkki töötab mürases keskkonnas paremini

View File

@@ -51,7 +51,7 @@ public class Printer3D : MonoBehaviour
private void InitializeSpawnedObject(GameObject spawnedObject) private void InitializeSpawnedObject(GameObject spawnedObject)
{ {
GameObject spawnedObjectParent = new GameObject("SpawnedModelParent"); GameObject spawnedObjectParent = new("SpawnedModelParent");
spawnedObjectParent.transform.parent = spawnPoint; spawnedObjectParent.transform.parent = spawnPoint;
spawnedObjectParent.transform.position = spawnPoint.transform.position; spawnedObjectParent.transform.position = spawnPoint.transform.position;
spawnedObjectParent.layer = ignorePlayerCollisionLayer; spawnedObjectParent.layer = ignorePlayerCollisionLayer;

View File

@@ -131,7 +131,7 @@ public class ShapeScanner : MonoBehaviour
UpdateDisplay(percentage); UpdateDisplay(percentage);
} }
private void OnConfigurationComplete() private async void OnConfigurationComplete()
{ {
// Destroy colliding scannable objects // Destroy colliding scannable objects
HashSet<GameObject> allCollidingObjects = new(); HashSet<GameObject> allCollidingObjects = new();
@@ -145,17 +145,19 @@ public class ShapeScanner : MonoBehaviour
var grab = collidingObject.GetComponent<XRGrabInteractable>(); var grab = collidingObject.GetComponent<XRGrabInteractable>();
if (grab != null && grab.isSelected) if (grab != null && grab.isSelected)
{ {
var interactor = grab.firstInteractorSelecting; // the hand/controller currently holding it var interactors = new List<IXRSelectInteractor>(grab.interactorsSelecting); // the controllers currently holding it
if (interactor != null) foreach (var interactor in interactors)
{ {
// Transfer ownership: tell the manager to stop the selection // Transfer ownership: tell the manager to stop the selection
interactionManager.SelectExit(interactor, grab); interactionManager.SelectExit(interactor, grab);
grab.enabled = false;
} }
} }
collidingObject.transform.position = Vector3.zero; collidingObject.transform.position = Vector3.zero;
Destroy(collidingObject); Destroy(collidingObject);
} }
await Task.Delay(100);
// Destroy all existing rays // Destroy all existing rays
foreach (ShapeScannerRay ray in existingRays) foreach (ShapeScannerRay ray in existingRays)
{ {

View File

@@ -40,9 +40,10 @@ public class ShapeScannerRay : MonoBehaviour
private void OnTriggerEnter(Collider other) private void OnTriggerEnter(Collider other)
{ {
if (other.gameObject.tag == scannableTag) if (other.gameObject.CompareTag(scannableTag))
{ {
collidingObjects.Add(other.gameObject); GameObject parent = other.transform.parent.gameObject;
collidingObjects.Add(parent);
// Only activate when this was the first object that entered collision // Only activate when this was the first object that entered collision
if (collidingObjects.Count == 1) if (collidingObjects.Count == 1)
{ {
@@ -64,9 +65,10 @@ public class ShapeScannerRay : MonoBehaviour
private void OnTriggerExit(Collider other) private void OnTriggerExit(Collider other)
{ {
if (other.gameObject.tag == "ShapeScannable") if (other.gameObject.CompareTag(scannableTag))
{ {
collidingObjects.Remove(other.gameObject); GameObject parent = other.transform.parent.gameObject;
collidingObjects.Remove(parent);
if (collidingObjects.Count == 0) if (collidingObjects.Count == 0)
{ {
foreach (MeshRenderer meshRenderer in meshRenderers) foreach (MeshRenderer meshRenderer in meshRenderers)