Search the Community
Showing results for tags 'spline'.
-
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;
-
Hello Babylon.js Community, I am trying to create a smooth 3D spline that goes through its control points. I was reading through the Curve3 tutorial and started a playground attempt: http://www.babylonjs-playground.com/#1GXSPK#1 My guess is that I have to create the spline step-by-step somehow with the BABYLON.Curve3.continue() function!?! Maybe I also miss a very simple approach to reach my goal? Wishfull thinking: Three.js offers exactly the spline I am looking for: https://threejs.org/docs/#Reference/Extras.Curves/CatmullRomCurve3 https://threejs.org/examples/#webgl_lines_splines Would something like this be of interest for the Curve3 class in general, e.g. var oMyNoBrainerCurve3 = new BABYLON.Curve3.CreateCatmullRom( Vector3[] ); Anyone can give me a hand? Any help is appreciated.