您可以创建一个自定义指针,将指针的旋转设置为根据手的位置推断,然后像您建议的那样使用Grip Pose
而不是Pointer Pose
姿势动作。
您的自定义指针的代码如下所示:
// Note you could extend ShellHandRayPointer if you wanted the beam bending,
// however configuring that pointer requires careful setup of asset.
public class HL1HandRay : LinePointer
{
public override Quaternion Rotation
{
get
{
// Set rotation to be line from head to head, rotated a bit
float sign = Controller.ControllerHandedness == Handedness.Right ? -1f : 1f;
return Quaternion.Euler(0, sign * 35, 0) * Quaternion.LookRotation(Position - CameraCache.Main.transform.position, Vector3.up);
}
}
// We cannot use the base IsInteractionEnabled
// Because HL1 hands are always set to have their "IsInPointing pose" field as false
// You may want to do more thorough checks here, following BaseControllerPointer implementation
public override bool IsInteractionEnabled => IsFocusLocked || IsTracked;
}
然后创建一个新的指针预制件并配置您的指针配置文件以使用新的指针预制件。创建您自己的预制件而不是修改 MRTK 预制件具有确保 MRTK 更新不会覆盖您的预制件的优势。

以下是我为测试它而制作的简单指针预制件的一些捕获,并突出显示了相关更改:

然后是我使用的组件:
