Jump to content

VRDeviceOreintation no following Spline dot positions


MrVR
 Share

Recommended Posts

Hi Guys can sombody helpme to make the VR camera follow the spline ?

 I try parenting the camera into a mesh that folllows the spline and the camera still on the ground.

I change the camera But I can see yet why its not updating the position here  is my

 

 http://www.babylonjs-playground.com/#21EWAB#9  


  // Target Cam

// VR CAMERA INSTEAD***************************************************************************** 

  var targetCam = new BABYLON.VRDeviceOrientationArcRotateCamera("tcam", camera.position, scene);
//   var targetCam = new BABYLON.TargetCamera("tcam", camera.position, scene);
  targetCam.setTarget(points[t]);
  scene.activeCamera = targetCam;
  var target = BABYLON.Vector3.Zero();

  // animation
  scene.registerBeforeRender(function() {
    //followCam._computeViewMatrix();
    points[i].addToRef(curvect.scale(k / step), pos);
    points[j].addToRef(nextvect.scale(k / step), target);
    pos.addInPlace(norms[i]);
    targetCam.position = pos;
    targetCam.setTarget(target);
    targetCam.getViewMatrix();
    //wagon.position = pos;
    //wagon.rotation = rot;
    k++;
    // next segment
    if (k == step) {
      i = (i + 1) % lg;
      j = (i + 1) % lg;
      t = (i + dt) % lg;
      rot = BABYLON.Vector3.RotationFromAxis(tgts[i], norms[i], binorms[i]);
      points[j].subtractToRef(points[i], curvect);
      points[t].subtractToRef(points[j], nextvect);
      //curvect.normalize();
      //nextvect.normalize();
      k = 0;
    }
  });
  return scene;

 

Link to comment
Share on other sites

Hi MrVR, sorry for the slow replies, hope you are dooooon gooooood.  :)

http://www.babylonjs-playground.com/#21EWAB#12

Line 207/208... I think "arcRotate"-type cameras need a few more parameters.  I adjusted.  :)

Line 220... changed to .setPosition() function for camera.  Suddenly, stuff started moving!  Weeeeeeee.  Don't ask me why it worked.  I think someone glued it to the ground.  heh.

I hope I'm using the camera that's broken.  There's too many cameras in that scene... I get confused.

I also disable line 221.  No need for continuous setTarget.  Could try .lockedTarget for fun, someday... but nah.   :)

Hope this helps.  Write back, as wanted, of course.

Link to comment
Share on other sites

On 3/26/2017 at 11:04 AM, Wingnut said:

Hi MrVR, sorry for the slow replies, hope you are dooooon gooooood.  :)

http://www.babylonjs-playground.com/#21EWAB#12

Line 207/208... I think "arcRotate"-type cameras need a few more parameters.  I adjusted.  :)

Line 220... changed to .setPosition() function for camera.  Suddenly, stuff started moving!  Weeeeeeee.  Don't ask me why it worked.  I think someone glued it to the ground.  heh.

I hope I'm using the camera that's broken.  There's too many cameras in that scene... I get confused.

I also disable line 221.  No need for continuous setTarget.  Could try .lockedTarget for fun, someday... but nah.   :)

Hope this helps.  Write back, as wanted, of course.

hey @Wingnut, your my new buddy, you end countless nights of frustration of me figuring this thing out jajaja :D, I will try tonight in my candy land scene and report back.

Thank you so much

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...