Question by
BergmanJason · Nov 20, 2019 at 03:03 PM ·
movementvrcharactercontrolleroculusoculus rift
How to move a player to a set position in vr
I have a trigger that I need to be able to adjust a player's position based on head movement and eventually translate the player to move into it. It seems to adjust the player position and then the player position gets immediately reset to 0,0,0, in world space. How do I get it to be the position that is specified and remain there after it sets the position?
public void OnTriggerEnter(Collider collision)
{
Debug.Log("Collided: " + collision.name);
if(collision.transform.tag == "PlayerHead")
{
Debug.Log("Checked Tag");
if (!inBox)
{
//player.transform.position = Vector3.Lerp(travelPointMice.transform.position, travelPointBox.transform.position, 2f * Time.deltaTime);
cameraRig = player.transform.GetChild(1);
cameraRig.GetComponent<OVRManager>().usePositionTracking = false;
player.transform.position = travelPointBox.transform.position;
cameraRig.GetComponent<OVRManager>().usePositionTracking = true;
Debug.Log("entered");
}
}
}
}
Comment