Skip to main content
New Participant
June 23, 2021

bug in OVRSkeleton update: capsules only update on first frame/initialization

in Oculus Integration 29.0, there is a bug that the hand capsules only update on the first frame, when the hand is initialized.

maybe it is due to some settings, but the capsule.CapsuleRigidbody.MovePosition and capsule.CapsuleRigidbody.position do not seem to work in unity 2020.3.12f1.

 

here is a quick hotfix with 2 lines of code, which sets the transform of the capsule GO

	private void FixedUpdate()
	{
		if (!IsInitialized || _dataProvider == null)
		{
			IsDataValid = false;
			IsDataHighConfidence = false;

			return;
		}

		Update();

		if (_enablePhysicsCapsules)
		{
			var data = _dataProvider.GetSkeletonPoseData();

			IsDataValid = data.IsDataValid;
			IsDataHighConfidence = data.IsDataHighConfidence;

			for (int i = 0; i < _capsules.Count; ++i)
			{
				OVRBoneCapsule capsule = _capsules[i];
				var capsuleGO = capsule.CapsuleRigidbody.gameObject;
				if (data.IsDataValid && data.IsDataHighConfidence)
				{
					Transform bone = _bones[(int)capsule.BoneIndex].Transform;
					if (capsuleGO.activeSelf)
					{
						capsule.CapsuleRigidbody.MovePosition(bone.position);
						capsule.CapsuleRigidbody.MoveRotation(bone.rotation);
					}
					else
					{
						capsuleGO.SetActive(true);
						capsule.CapsuleRigidbody.position = bone.position;
						capsule.CapsuleRigidbody.rotation = bone.rotation;
					}
					//this is a temporary hotfix. should be avoided, because accessing GO each frame for each capsule is slow!
					capsule.CapsuleRigidbody.gameObject.transform.position = bone.position;
					capsule.CapsuleRigidbody.gameObject.transform.rotation = bone.rotation;
					
				}
				else
				{
					if (capsuleGO.activeSelf)
					{
						capsuleGO.SetActive(false);
					}
				}


			}
		}
	}

not sure where to post this, i couldnt find a git, or bug report location.

    This topic has been closed for replies.

    1 reply

    New Participant
    June 23, 2021

    seems to be a duplicate of Skeleton physical colliders pose not updated durin... - Oculus Community - 803717 (oculusvr.com)

    odd that this is not fixed yet. is there are version where the original code works?