1
0
forked from cgvr/DeltaVR

fix bug with player colliding with spawned model when holding it

This commit is contained in:
2026-01-27 17:50:13 +02:00
parent 15b92e92b4
commit 77fc43bebd
4 changed files with 36 additions and 9 deletions

View File

@@ -1,9 +1,6 @@
using FishNet.Component.Transforming;
using FishNet.Object;
using System;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.XR.Interaction.Toolkit;
public class ShapeDetectionMinigameController : MonoBehaviour
{
@@ -16,6 +13,7 @@ public class ShapeDetectionMinigameController : MonoBehaviour
public GameObject GeneratedModel { get; private set; }
public Transform modelSpawnPoint;
public string shapeScannerTag = "ShapeScannable";
public int ignorePlayerCollisionLayer = 2;
private bool modelGenerationInProgress;
@@ -70,6 +68,7 @@ public class ShapeDetectionMinigameController : MonoBehaviour
GameObject spawnedObjectParent = new GameObject("SpawnedModelParent");
spawnedObjectParent.transform.parent = modelSpawnPoint;
spawnedObjectParent.transform.position = modelSpawnPoint.transform.position;
spawnedObjectParent.layer = ignorePlayerCollisionLayer;
Rigidbody rigidbody = spawnedObjectParent.AddComponent<Rigidbody>();
rigidbody.isKinematic = true;
@@ -81,6 +80,7 @@ public class ShapeDetectionMinigameController : MonoBehaviour
spawnedObject.transform.parent = spawnedObjectParent.transform;
spawnedObject.transform.position = spawnedObjectParent.transform.position;
spawnedObject.tag = shapeScannerTag;
spawnedObject.layer = ignorePlayerCollisionLayer;
spawnedObjectParent.AddComponent<TwoHandScaleGrabInteractable>();
}