Jump to content

Parent Mesh with VRDeviceOrientationFreeCamera


AndyBeaulieu
 Share

Recommended Posts

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

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...