【发布时间】:2021-04-03 10:23:38
【问题描述】:
如何在 Unity 中找到鼠标位置?我正在使用新的输入系统,我已经尝试过
InputDevice mouse = Mouse.current;
Ray ray = camera.ScreenPointToRay(mouse.position);
,但它没有工作。有人吗?
【问题讨论】:
如何在 Unity 中找到鼠标位置?我正在使用新的输入系统,我已经尝试过
InputDevice mouse = Mouse.current;
Ray ray = camera.ScreenPointToRay(mouse.position);
,但它没有工作。有人吗?
【问题讨论】:
使用这个:
Ray ray = camera.ScreenPointToRay(Mouse.current.position.ReadValue());
【讨论】:
Physics.Raycast 没有引用我的光线投射:if (Physics.Raycast(ray, out hit)) { navMeshAgent.SetDestination(hit.point); }
mouse.position 替换为 mouse.position.ReadValue() ?