vethetheth Posted June 17, 2022 Author Share Posted June 17, 2022 I would like to, yes please. My only wish is that it also recenter my hands. Link to comment Share on other sites More sharing options...
VIVE_chengnay Posted June 17, 2022 Share Posted June 17, 2022 Hi @vethetheth, I created this script, let me know if it is ok for you? using UnityEngine; public class RecenterScript : MonoBehaviour { public GameObject VROrigin; public GameObject Camera; public void Recenter() { var cameraLocalRot = Quaternion.Euler(0, Camera.transform.localEulerAngles.y, 0); Matrix4x4 camLoacalNow = Matrix4x4.TRS(Camera.transform.localPosition, cameraLocalRot, Vector3.one); var targetHeight = Camera.transform.position.y; var targetPos = new Vector3(Camera.transform.position.x, targetHeight, Camera.transform.position.z); Matrix4x4 TargetPos = Matrix4x4.TRS(targetPos, Quaternion.identity, Vector3.one); Matrix4x4 CameraRigWorld = TargetPos * Matrix4x4.Inverse(camLoacalNow); Vector3 XZPos = CameraRigWorld.GetColumn(3); VROrigin.transform.position = XZPos; VROrigin.transform.rotation = CameraRigWorld.rotation; } } I tested with Tutorial scene from VIU example scene. You simply add the Recenter function to the button. I made some modifications to the scene by adding VROrigin and move ViveCameraRig and VivePointers to its child. Link to comment Share on other sites More sharing options...
vethetheth Posted June 17, 2022 Author Share Posted June 17, 2022 Hello @chengnay, thanks for the code ! I did as you said, and the rotation works perfectly for the hands. But the position is not reset : wherever I move, i am always at the same distance of the button as before. Link to comment Share on other sites More sharing options...
VIVE_chengnay Posted June 17, 2022 Share Posted June 17, 2022 Hi @vethetheth, Isn't this is the purpose of recenter? Just like before when you use the WVR_InAppRecenter API, it does the same right? Please correct me if I did something wrong. 🙂 Link to comment Share on other sites More sharing options...
vethetheth Posted June 27, 2022 Author Share Posted June 27, 2022 Hello @chengnay, sorry for the long absence without response. What we wanted to do with the recenter was : reset the rotation (it works perfectly with your code) and reset the position of the player to the center of our scene (we could use a 0,0,0 transform GameObject for example). We managed to do both separately but not at the same time. And the WVR_RECENTER of the API doesn't work with hand tracking. Thanks for your help in advance. Link to comment Share on other sites More sharing options...
vethetheth Posted June 27, 2022 Author Share Posted June 27, 2022 Interop.WVR_InAppRecenter(WVR_RecenterType.WVR_RecenterType_YawAndPosition); This line doest exactly what we need : it recenter the view, and it resets our position, the controller are fine too. But the hand tracking hands are not reset. I tried to deactivate the hand tracking / resetting their position so they can be at the good place after recentering but i couldn't make it work... Do you have an idea while they try to fix it internally ? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now