Forum Discussion
stevenlinton
1 year agoProtege
Bugfix for hand touch physics
There is a small but annoying bug that has taken me quite a while to diagnose and fix so I thought I'd share.
We have a bug where the physics hands would press buttons and trigger things when the player wasn't actually performing the action. This was usually caused when the game started, scene transitions or when network players joined a game. I ended up being able to replicate the bug using a stationary boundary and moving in and out of it. If you track the velocity of the hand joints you can see they jump to extremely high values when the hands are redetected - caused unintended interactions.
This is a bug in a Meta class (hopefully this will be fixed in a future update).
How to fix, copy HandPhysicsCapsules and change the following function as follows.
HandPhysicsCapsules
private void UpdateRigidbodies()
{
for (HandJointId jointId = HandJointId.HandStart; jointId < HandJointId.HandMaxSkinnable; ++jointId)
{
if (!TryGetJointRigidbody(jointId, out Rigidbody jointbody))
{
continue;
}
GameObject jointGO = jointbody.gameObject;
if (_capsulesAreActive
&& Hand.GetJointPose(jointId, out Pose bonePose))
{
if (!jointGO.activeSelf)
{
// set position and rotation directly so that the rigidbody doesn't perform collisions between old and new location when the hand was lost
jointbody.transform.SetPositionAndRotation(bonePose.position, bonePose.rotation);
jointGO.SetActive(true);
jointbody.WakeUp();
}
else
{
jointbody.MovePosition(bonePose.position);
jointbody.MoveRotation(bonePose.rotation);
}
}
else if (jointGO.activeSelf)
{
jointbody.Sleep();
jointGO.SetActive(false);
}
}
}
2 Replies
Replies have been turned off for this discussion
This is fantastic. Thanks for sharing
- stevenlintonProtege
Follow up. This totally didn't work. Still have the issue. Will update when I finally figure it out and fix.
Quick Links
- Horizon Developer Support
- Quest User Forums
- Troubleshooting Forum for problems with a game or app
- Quest Support for problems with your device
Other Meta Support
Related Content
- 10 days ago
- 1 month ago