Issue with Oculus Quest Hand Tracking Physics Capsules

I’m having an issue where the OVR Skeleton Physics Capsules are moving when they collide with a Box Collider trigger. Here’s a video demonstrating this;

The all stop touchscreen button ‘STP’ resets the velocity applied to the main ship’s rigidbody with Vector3.zero, weird that it’s resetting the OVR skeleton as well. I do have the OVR Camera Rig as a child to the main gameobject that I applied the rigidbody too…

Here’s the code I hobbled together for touchscreen buttons. I have it so the actual box collider trigger on the button moves away from the actual button for 1 second then returns - I did this OnTriggerEnter was firing to many times, and I’m a novice when it comes to Unity and C#, I’m sure there is a better way;

public class ButtonTrigger : MonoBehaviour
{
    [SerializeField]
    private Sprite pressedSprite;

    [SerializeField]
    private Sprite resetSprite;

    private BoxCollider bC;

    [SerializeField]
    private SpriteRenderer sR;

    [SerializeField]
    private UnityEvent onButtonPressed;

    private Vector3 resetPos = new Vector3(0, 0, 0);

    private Vector3 pushPos = new Vector3(0,0,-0.05f);

    public float timer = 0.0f;

    public bool isPushed = false;

    void Start()
    {
       bC = GetComponent<BoxCollider>();              
    }

    private void Update()
    {
        if (isPushed == true)
        {
            timer += Time.deltaTime;
            if (timer >= 1f)
            {
                bC.transform.localPosition = resetPos;
                isPushed = false;
                timer = 0f;
                sR.sprite = resetSprite;
            }
        }
    }

    private void OnTriggerEnter(Collider other)
    {       
        onButtonPressed?.Invoke();
        sR.sprite = pressedSprite;
        bC.transform.localPosition = pushPos;
        isPushed = true;
    }
}

I’d appreciate any suggestions. Oh and this project is just for myself, something to keep me motivated while learning blender, unity and C# - I know how much CBS likes to ruin the fun for Star Trek fans :slight_smile:

I also noticed that when the bone physics capsules are generated at runtime they don’t become child objects within the OVRCamerarig - could this be why?

I’ve finally found a fix for this, provided by the user paperli on the oculus forums here;

Here was the code fix;

in the OVRSkeleton.cs script locate the following code;

if (capsuleGO.activeSelf)
{
    capsule.CapsuleRigidbody.MovePosition(bone.position);
    capsule.CapsuleRigidbody.MovePosition(bone.rotation);
}
else
{
    capsuleGO.SetActive(true);
    capsule.CapsuleRigidbody.position = bone.position;
    capsule.CapsuleRigidbody.rotation = bone.rotation;
}

and then change it to;

if (capsuleGO.activeSelf)
{
    capsule.CapsuleRigidbody.gameObject.transform.position = bone.position;
    capsule.CapsuleRigidbody.gameObject.transform.rotation = bone.rotation;
}
else
{
    capsuleGO.SetActive(true);
    capsule.CapsuleRigidbody.gameObject.transform.position = bone.position;
    capsule.CapsuleRigidbody.gameObject.transform.rotation = bone.rotation;
}
1 Like

Thanks! I had the same issue and was exploring this too.

For anyone interested in the future, we might have found something different here: https://communityforums.atmeta.com/t5/Quest-Development/Hand-physics-Capsules-not-following-the-fingers/td-p/814918/page/2