improved door grabbing. Sometimes leaves ghost hands.

This commit is contained in:
2025-12-15 21:16:03 +02:00
parent 252e7a2fa6
commit 98526fd582
12 changed files with 546 additions and 152 deletions

View File

@@ -10,6 +10,8 @@ namespace _PROJECT.NewHandPresence
public bool showController;
public bool showHand;
private bool inDoorGrabRadius = false;
public InputDeviceCharacteristics controllerCharacteristics;
public List<ControllerInformationScriptableObject> controllerInformation;
@@ -113,5 +115,37 @@ namespace _PROJECT.NewHandPresence
updateAnimation();
}
}
}
private void OnDisable()
{
if (!inDoorGrabRadius) return;
if (_spawnedHandModel != null)
_spawnedHandModel.SetActive(false);
if (_spawnedController != null)
_spawnedController.SetActive(false);
}
private void OnEnable()
{
// Let Update handle visibility naturally
// or force refresh:
if (_spawnedHandModel != null)
_spawnedHandModel.SetActive(showHand);
if (_spawnedController != null)
_spawnedController.SetActive(showController);
}
private void OnTriggerEnter(Collider other)
{
if (other.GetComponent<DoorHandReplacer>() == null) return;
inDoorGrabRadius = true;
}
private void OnTriggerExit(Collider other)
{
if (other.GetComponent<DoorHandReplacer>() == null) return;
inDoorGrabRadius = false;
}
}
}