AlbertoBonn Posted September 30, 2015 Share Posted September 30, 2015 Hi Folks, looking for a solution to set the camera position back after i release my mousebutton to view in a direction. thanx Quote Link to comment Share on other sites More sharing options...
iiceman Posted September 30, 2015 Share Posted September 30, 2015 Hi Alberto, FreeCamera? No animation, just reset? Then the simplest solution could look like that i guess: http://www.babylonjs-playground.com/#29VIXL Is that already what you need? Quote Link to comment Share on other sites More sharing options...
AlbertoBonn Posted October 1, 2015 Author Share Posted October 1, 2015 thanx you iiceman for the direct awnser. Its right ,but it bend back and then...it scroll further in the mouse selected direction. How we can solve this?! Quote Link to comment Share on other sites More sharing options...
iiceman Posted October 1, 2015 Share Posted October 1, 2015 Sorry, I don't really know what you mean... can you explain it a bit more in detail or show an example? Quote Link to comment Share on other sites More sharing options...
Wingnut Posted October 2, 2015 Share Posted October 2, 2015 Hi guys/gals! I see this too, Icebreaker... in your demo. During a drag... release the button while the pointer is still traveling. The camera still moves after the button release... in my FF anyway. Likely, it is related to the camera's .inertia. http://www.babylonjs-playground.com/#29VIXL#1 As you can see, turning it off reduces the problem, but it's still there. Release the button while continuing the drag... the issue can still be seen. *scratch scratch* Quote Link to comment Share on other sites More sharing options...
iiceman Posted October 2, 2015 Share Posted October 2, 2015 Okay, I see the problem in my example. But yours looks good to me Wingman! I couldn't reproduce the problem with your playground anymore. Lets wait and see if Alberto is happy with yours Quote Link to comment Share on other sites More sharing options...
AlbertoBonn Posted October 5, 2015 Author Share Posted October 5, 2015 Thanx Wing, thats what Im looking for. Here my code: var wasd={l:0,r:0,f:0,b:0,s:0.03};function kDwn(evt){switch(evt.keyCode){case 65:wasd.l=1;break;case 68:wasd.r=1;break;case 87:wasd.f=1;break;case 83:wasd.b=1;break;}}function kUp(evt){switch(evt.keyCode){case 65:wasd.l=0;break;case 68:wasd.r=0;break;case 87:wasd.f=0;break;case 83:wasd.b=0;break;}}window.addEventListener("keyup", kUp, false);window.addEventListener("keydown", kDwn, false);if(BABYLON.Engine.isSupported()){ var canvas = document.getElementById("cnvs"); var engine = new BABYLON.Engine(canvas, true); BABYLON.SceneLoader.Load("","scene.babylon",engine,function(scn){ scn.executeWhenReady(function(){ scn.activeCamera.attachControl(canvas); var actC=scn.activeCamera; var cDir=actC.cameraDirection; var rstV=actC.rotation; //window.addEventListener("mouseup",function(){actC.rotation=new BABYLON.Vector3(rstV.x,rstV.y,rstV.z)}); engine.runRenderLoop(function(){ if(wasd.f==1)cDir.z+=wasd.s;if(wasd.b==1)cDir.z-=wasd.s;if(wasd.r==1)cDir.x+=wasd.s;if(wasd.l==1)cDir.x-=wasd.s; scn.render(); }); }); }, function(progress){ // To do: give progress feedback to user });} I hope you find a smaller solution! I need a WASD controll... maybe you can help me out.Thanx a lot 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.