1
0
forked from cgvr/DeltaVR

added detailed collisions to hands, needs to be configured for Vivegit status! Also, added more complex collisions to furniture and simplified existing scene object collisions

This commit is contained in:
2025-10-29 21:32:26 +02:00
parent 84a925b68f
commit a3975d85f7
30 changed files with 5470 additions and 266 deletions

View File

@@ -62,7 +62,7 @@ namespace _PROJECT.NewHandPresence
_targetDevice = devices[0];
Debug.Log("Found device: " + _targetDevice.name + _targetDevice.characteristics);
ControllerInformationScriptableObject controllerInfo =
controllerInformation.Find(x => _targetDevice.name.ToLower().Contains(x.controllerName.ToLower()));
@@ -70,19 +70,36 @@ namespace _PROJECT.NewHandPresence
var transform1 = transform.parent; // Right/Left hand direct position
_spawnedController = Instantiate(controllerInfo.controllerPrefab,
transform1.TransformPoint(Quaternion.Euler(controllerInfo.controllerRotationOffset) * controllerInfo.controllerOffset),
transform1.rotation * Quaternion.Euler(controllerInfo.controllerRotationOffset),
transform1);
_xrControllerAnimator = _spawnedController.GetComponent<XRControllerAnimator>();
_spawnedHandModel = Instantiate(controllerInfo.handPrefab,
// --- Spawn hand model first ---
_spawnedHandModel = Instantiate(
controllerInfo.handPrefab,
transform1.TransformPoint(Quaternion.Euler(controllerInfo.handRotationOffset) * controllerInfo.handOffset),
transform1.rotation * Quaternion.Euler(controllerInfo.handRotationOffset),
transform1.rotation * Quaternion.Euler(controllerInfo.handRotationOffset),
transform1);
_handAnimator = _spawnedHandModel.GetComponent<Animator>();
// --- Find the correct child in the hand prefab ---
Transform attachPoint = null;
if (_spawnedHandModel.name.Contains("Left"))
attachPoint = _spawnedHandModel.transform.Find("hands:l_hand_world");
else if (_spawnedHandModel.name.Contains("Right"))
attachPoint = _spawnedHandModel.transform.Find("hands:r_hand_world");
if (attachPoint == null)
{
Debug.LogWarning("Attach point not found in hand prefab, defaulting to hand root.");
attachPoint = _spawnedHandModel.transform;
}
// --- Spawn controller under the hand ---
_spawnedController = Instantiate(controllerInfo.controllerPrefab, attachPoint);
_spawnedController.transform.localPosition = controllerInfo.controllerOffset;
_spawnedController.transform.localRotation = Quaternion.Euler(controllerInfo.controllerRotationOffset);
_xrControllerAnimator = _spawnedController.GetComponent<XRControllerAnimator>();
}
private void UpdateControllerAnimation()
{
_xrControllerAnimator.UpdateAnimations(_targetDevice);