cancel
Showing results for 
Search instead for 
Did you mean: 

Move OVRPlayerController programmatically translates a character to a wrong location

masta-yoda
Protege
I'm trying to teleport a user that meets certain criteria to a specific location on my level. I'm using OVRPlayerController and have a container object for that controller. Whenever I move the container via container.transform.position, it moves the container but also randomly moves the OVRPlayerController inside of that container. How can I disable this behavior? The CameraRig from OpenVR works just fine with the same approach so it's only OVRPlayerController affected by this.
1 REPLY 1

masta-yoda
Protege
I think I found a workaround. Just disable OVRPlayerController while updating the position, no need to do delays:

```
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;
        }
    }
}
```