1
0
forked from cgvr/DeltaVR

generated objects are grabbable and scalable

This commit is contained in:
2026-01-13 19:22:44 +02:00
parent 1cd97e4d0a
commit 33a40c987a
4 changed files with 109 additions and 8 deletions

View File

@@ -67,17 +67,19 @@ public class ShapeDetectionMinigameController : MonoBehaviour
private void InitializeSpawnedObject(GameObject spawnedObject)
{
Rigidbody rigidbody = spawnedObject.AddComponent<Rigidbody>();
GameObject spawnedObjectParent = new GameObject("SpawnedModelParent");
spawnedObjectParent.transform.parent = modelSpawnPoint;
spawnedObjectParent.transform.position = modelSpawnPoint.transform.position;
Rigidbody rigidbody = spawnedObjectParent.AddComponent<Rigidbody>();
rigidbody.isKinematic = true;
//spawnedObject.AddComponent<NetworkObject>();
//spawnedObject.AddComponent<NetworkTransform>();
spawnedObject.transform.parent = modelSpawnPoint;
spawnedObject.transform.position = modelSpawnPoint.position;
spawnedObject.transform.parent = spawnedObjectParent.transform;
spawnedObject.transform.position = spawnedObjectParent.transform.position;
spawnedObject.tag = shapeScannerTag;
spawnedObject.SetActive(true);
spawnedObject.AddComponent<XRGrabInteractable>();
spawnedObjectParent.AddComponent<TwoHandScaleGrabInteractable>();
}
}