当我按下一个按钮时,我试图将玩家传送到塔顶上。在Unity中它工作得很好,但是在Oculus Quest中,玩家只在一帧中处于正确的位置,然后被下移。
有时(我不能重现这个),玩家实际上被正确地传送了。通过使用"Oculus集成“中包含的”远程传送瞄准处理器抛物线“进行正常的传送工作良好。
我试着简单地移动PlayerController。在传送之前,我试着通过脚本将目标标记移动到目标。我尝试通过LocomotionTeleport.DoTeleport()移动球员,然后提升球员的位置。
我尝试过的所有方法在编辑器中都有效,但在任务中,在y改变之前,玩家只在一帧的正确位置上(正常到传送之前的状态)。
发布于 2020-06-17 15:40:19
找到了更简单的解决方案,只需在更新位置时禁用OVRPlayerController,不需要做延迟:
public class MoveObjectBySpace : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
if(Input.GetKeyDown(KeyCode.Space))
{
var player = GetComponentInChildren<OVRPlayerController>();
player.enabled = false;
transform.position = new Vector3(Random.Range(-5, 5), transform.position.y, Random.Range(-5, 5));
player.enabled = true;
}
}
}发布于 2019-07-22 16:16:30
我找到了一个方法来做到这一点。问题出现在"OVRPlayerController".上通过在传送到塔顶之前关闭它半秒,传送工作。我相信有一种更好的方法可以做到这一点,但它只是一个开始。
发布于 2019-09-28 10:32:29
我和你的情况一样。正如你在回答中所说的,它是有效的。但是,当头盔显示器从其起始位置移动时(佩戴耳机的人稍微走动,这反过来会在3D空间中移动OVRPlayerController和摄像平台),然后当您将其传送到顶层时,它并没有传送到确切的位置。它将OVRPlayerController的当前位置添加到远程传送位置。有时它会从地板上掉下来,球员会摔倒。
我的层次结构是
Parent - >Player
Child -> OVRPlayerController
Child of child - > CameraRig我的脚本如下所示:
void Update(){
oVRPlayerController.GetComponent<CharacterController>().enabled = isPlayerActive;
if (recenter)
{
oVRPlayerController.localPosition = new Vector3(0, oVRPlayerController.localPosition.y, 0);
cameraRig.localPosition = new Vector3(0, cameraRig.localPosition.y, 0);
recenter = false;
}
}
public void HomeTeleport() //Assign this in the menu button.
{
isPlayerActive = false;
Invoke("TeleToTop", 0.5f);
}
public void TeleToTop()
{
player.position = TopPosition;
player.rotation = TopRotation;
isPlayerActive = true;
recenter = true;
}我怀疑家长玩家在这个偏移量问题上是空的。您是否直接将OVRPlayerControllers位置更改为远程传送点?
https://stackoverflow.com/questions/57061772
复制相似问题