AndyBeaulieu Posted June 25, 2017 Share Posted June 25, 2017 Hi All, (I edited this post so it's a bit more clear)... Using a FreeCamera, I can set camera.parent equal to a mesh so that the camera moves with the mesh: http://www.babylonjs-playground.com/#PPEC6R But if I try this with a VR Free Camera (VRDeviceOrientationFreeCamera or WebVRFreeCamera), then it doesn't seem to work (the camera does not move with the mesh)... http://www.babylonjs-playground.com/#PPEC6R#1 What I am trying to do is simulate "riding" on a vehicle or object. Any ideas are appreciated! Thanks, -Andy Quote Link to comment Share on other sites More sharing options...
Wingnut Posted June 26, 2017 Share Posted June 26, 2017 Hi Andy, good to see you. I hope you have been well. I know of workaround. [link #2] See lines 30-31. Might not be correct way, but it works. Hope this helps. Smarter people than I ...will surely comment soon. Nesh108 and javalang 2 Quote Link to comment Share on other sites More sharing options...
AndyBeaulieu Posted June 26, 2017 Author Share Posted June 26, 2017 Thanks Wingnut! Very good idea - so setting each individual L/R camera. I wonder if this will work with the WebVRFreeCamera as well? I'll do some tests and report back here. Wingnut 1 Quote Link to comment Share on other sites More sharing options...
Wingnut Posted June 26, 2017 Share Posted June 26, 2017 Sounds good, thx! There might be some pivot point considerations involved here. The left eye and right eye should not be rotating precisely the same, and with this work-around kludge, they are doing so. There is an... umm... .lensSeparationDistance and .interpupillaryDistance involved in the metrics of VR cameras. Essentially, it is the nose-bridge width, I think. Both cameras are not in the same position. They are separated by some distance. SO, when both side-by-side cameras are looking at the same target... their rotation values will not PERFECTLY match. The camera that is furthest from the target... will be rotated a bit further than the other, I think. This is a potential problem. No problems for simple spinning of both cameras like our demo is doing. But more problem when you wear the VR glasses and you have problems getting left/right rotational "coordination"... and you get a brain tumor after 15 minutes of game-play. Truth is, the rig itself... should allow parenting... but the rig is really a matrix transformation, I believe (similar to a bone). Perhaps, to do this task properly, each camera's CURRENT transformation... should be multiplied by the rotating box transformation... each frame. (ouch) This way, the box's rot transform is "affecting" each camera viewMatrix, but not forcing it to be a COPY of box's rot transform. Box's rot transform becomes an OFFSET which is added to each camera's current rot. The two cameras always maintain their slight difference-in-rotation from each other, that way. It's pretty much over my head... but... forcing left/right camera rotations... to be COPIES-of box rotation... seems like an improper solution (kludge) that could cause problems in a project. *shrug* Party on. Nesh108 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.