forked from cgvr/DeltaVR
fix bug with player colliding with spawned model when holding it
This commit is contained in:
@@ -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>();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user