Forum Discussion
masta-yoda
5 years agoProtege
Move OVRPlayerController programmatically translates a character to a wrong location
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
- masta-yodaProtegeI 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 updatevoid Start(){}// Update is called once per framevoid 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;}}}```
Quick Links
- Horizon Developer Support
- Quest User Forums
- Troubleshooting Forum for problems with a game or app
- Quest Support for problems with your device
Other Meta Support
Related Content
- 3 years ago
- 29 days ago