MrVR Posted March 23, 2017 Share Posted March 23, 2017 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; Quote Link to comment Share on other sites More sharing options...
Wingnut Posted March 26, 2017 Share Posted March 26, 2017 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. Quote Link to comment Share on other sites More sharing options...
MrVR Posted March 29, 2017 Author Share Posted March 29, 2017 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 , I will try tonight in my candy land scene and report back. Thank you so much Wingnut 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.