leon.fuchs Posted October 18, 2021 Share Posted October 18, 2021 Hello everyone, I am using a HTC Vive. And have the problem that as soon as I lock the position of the headset, the position of the VR player is not on the same position as that of the headset. But is approximately around the vector (0.5, 0.5, 1.7) shifted. Here is an example: int AppWorldLogic::init() { proxy = new AppViveProxy(); proxy->init(); proxy->setHeadPositionLock(1); return 1; } int AppWorldLogic::update() { VRPlayer* vr_player = VRPlayer::get(); NodePtr Node1 = World::getNodeByName("NodeDummy_3"); vr_player->getPlayer()->setWorldTransform(Node1->getWorldTransform()); return 1; } Link to comment
silent Posted October 19, 2021 Share Posted October 19, 2021 Hi Leon, Have you tried to simply clearing stored camera offset? vr_player->getPlayer()->getCamera()->setOffset(mat4_identity); Thanks! How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
leon.fuchs Posted October 19, 2021 Author Share Posted October 19, 2021 Hello silent, unfortunately this has not solved my problem yet. I'll try to explain it a bit more in detail again. When I rotate the controller in front of the VR glasses, the controller rotates around the axis of the offset and not around the locked VR glasses position. Thanks Link to comment
karpych11 Posted October 19, 2021 Share Posted October 19, 2021 Hello, You can try to fix the controller position update function void controller_update(int num, const Mat4 &player_transform, int device_id) in class VRPlayerVive. void VRPlayerVive::controller_update(int num, const Mat4 &player_transform, int device_id) { if (device_id != -1 && vive.isDeviceConnected(device_id)) { mat4 transform = vive.getDevicePose(device_id); // get controller position for custom player transform Mat4 hmd_transform = Mat4(vive.getDevicePose(HMD_DEVICE_0)); vec3 delta = inverse(translate(hmd_transform.getTranslate())) * transform.getTranslate(); transform.setColumn3(3, delta); controller[num]->setWorldTransform(player_transform * Mat4(transform) * Mat4(rotateX(-90.0f))); //... } We change the position of the controller from global to local relative to the HMD. 1 Link to comment
Recommended Posts