I’m trying to make hand-free application.
if (!NRInput.GetButtonDown(ControllerButton.TRIGGER))
{
return;
}
var handControllerAnchor = NRInput.DomainHand == ControllerHandEnum.Left ? ControllerAnchorEnum.LeftLaserAnchor : ControllerAnchorEnum.RightLaserAnchor;
Transform laserAnchor = NRInput.AnchorsHelper.GetAnchor(NRInput.RaycastMode == RaycastModeEnum.Gaze ? ControllerAnchorEnum.GazePoseTrackerAnchor : handControllerAnchor);
RaycastHit hitResult;
int layerMask = 1 << LayerMask.NameToLayer("Map");
if (Physics.Raycast(new Ray(laserAnchor.transform.position, laserAnchor.transform.forward), out hitResult, layerMask))
{
These scripts are imitating code from hand tracking demo and I want to use ray from hands to make rayhit.
I found ControllerTracker and NRHand_R have their own LaserRaycaster.
Even though I dis-active ControllerTracker in NRInput, I cant get any rayhit on hand tracking mode.
How can I switch to laserAnchor from handtracking?
Ok need a bit more information.
Are you using the NRInput.GetButtonDown to trigger the rayhit?? Does that condition ever get becomes true?
I set it not to return so it can skip that part, and still get no rayhit .
Since rays are made from laserAnchor, I tried to find transfrom of laserAnchor for hand tracking.
but there is no change on transform even I set different using GetAnchor(ControllerAnchorEnum.~~)
.
public enum ControllerAnchorEnum
{
/// <summary> An enum constant representing the gaze pose tracker anchor option. </summary>
GazePoseTrackerAnchor,
/// <summary> An enum constant representing the right pose tracker anchor option. </summary>
RightPoseTrackerAnchor,
/// <summary> An enum constant representing the left pose tracker anchor option. </summary>
LeftPoseTrackerAnchor,
/// <summary> An enum constant representing the right model anchor option. </summary>
RightModelAnchor,
/// <summary> An enum constant representing the left model anchor option. </summary>
LeftModelAnchor,
/// <summary> An enum constant representing the right laser anchor option. </summary>
RightLaserAnchor,
/// <summary> An enum constant representing the left laser anchor option. </summary>
LeftLaserAnchor
}
To solve this issue, i worked on unity interface…
I just used transform of NRHandPointer_R (from NRHand_R on NRInput).