Is there a way to hide the OVRAvatarHands when picking up an object?
Thanks!
Is there a way to hide the OVRAvatarHands when picking up an object?
Thanks!
what i di is hiding the SkinnedMeshRenderer of the Oculus hands
if (RightHand)
{
Transform pathToHandR = gameObject.transform.Find("hand_right_renderPart_0");
SkinnedMeshRenderer RHModel = patheToHandR.GetComponent<SkinnedMeshRenderer>();
RHModel.enabled = true;
}
else
{
Transform pathToHandL = gameObject.transform.Find("hand_left_renderPart_0");
SkinnedMeshRenderer LHModel = patheToHandL.GetComponent<SkinnedMeshRenderer>();
LHModel.enabled = true;
}
and then just triggering it when I pick something or let go of something
hope it helps
You just need to add a script to the LocalAvatar prefab. Then, you can enable or disable HandRight and HandLeft from the OvrAvatar component:
public class LocalAvatarManager : MonoBehaviour
{
private OvrAvatar avatar = null;
private void Start()
{
avatar = GetComponent<OvrAvatar>();
}
public void ShowOrHideRightHand()
{
if (avatar.HandRight.enabled)
{
avatar.HandRight.enabled = false;
avatar.HandRight.RenderParts[0].mesh.enabled = false;
}
else
{
avatar.HandRight.enabled = true;
// No need to enable the SkinnedMeshRenderer, enabling the hand will do it for you
}
}
public void ShowOrHideLeftHand()
{
if (avatar.HandLeft.enabled)
{
avatar.HandLeft.enabled = false;
avatar.HandLeft.RenderParts[0].mesh.enabled = false;
}
else
{
avatar.HandLeft.enabled = true;
// No need to enable the SkinnedMeshRenderer, enabling the hand will do it for you
}
}
}
Can i disable hands avr player?
Add this script to the hand anchor, and select the controller (R/H hand) depending on the hand and link the skeleton to the one corresponding to that hand.
When the pose is not correct the hand disappears.
public OVRInput.Controller controller;
public OVRCustomSkeleton skeleton;
public void SetActiveHands(bool active)
{
SkinnedMeshRenderer pathToHand = skeleton.GetComponentInChildren<SkinnedMeshRenderer>();
if (pathToHand)
{
pathToHand.enabled = active;
}
}
void Update()
{
//is valid position
if (!OVRInput.GetControllerOrientationTracked(controller))
{
//_GestureScoreText.text = controller + " Disabled";
SetActiveHands(false);
return;
}
}