akira fan Posted August 8, 2018 Share Posted August 8, 2018 Hi, I have tried the following code. I can get the rotation of the controller but the when I try to get the position, it always gives me 0,0,0. Is there a way to get the position of the controller? Thank you public WVR_DeviceType device = WVR_DeviceType.WVR_DeviceType_Controller_Right;public GameObject modelGO;void Update () { WaveVR_Utils.RigidTransform trans = WaveVR_Controller.Input(device).transform; modelGO.transform.position = trans.pos; modelGO.transform.rotation = trans.rot;} private WVR_DevicePosePair_t[] poses = new WVR_DevicePosePair_t[3]; // HMD, R, L controllers. public WVR_DeviceType device = WVR_DeviceType.WVR_DeviceType_Controller_Right; private WaveVR_Utils.RigidTransform[] rtPoses = new WaveVR_Utils.RigidTransform[3];public GameObject modelGO;void Update () { WaveVR.Device _device = WaveVR.Instance.getDeviceByType(device); WVR_DeviceType _type = _device.type; WVR_PoseOriginModel origin = WVR_PoseOriginModel.WVR_PoseOriginModel_OriginOnGround; Interop.WVR_GetSyncPose(origin, poses, (uint)poses.Length); for (int i = 0; i < poses.Length; i++) { if (poses[i].type == _type && poses[i].pose.IsValidPose) { rtPoses[i].update(poses[i].pose.PoseMatrix); updatePose(rtPoses[i]); break; } }} public void updatePose(WaveVR_Utils.RigidTransform pose) { modelGO.transform.localPosition = pose.pos; modelGO.transform.localRotation = pose.rot; } Link to comment Share on other sites More sharing options...
akira fan Posted August 8, 2018 Author Share Posted August 8, 2018 Ok the controller is 3 DoF, so there is no way to get correct position info. Link to comment Share on other sites More sharing options...
Tony PH Lin Posted August 8, 2018 Share Posted August 8, 2018 Hi , Yes, you're right. Thanks. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.