Jump to content

Camera position jump back after mouse release

Go to solution Solved by Wingnut,

Recommended Posts

  • Solution

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.




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*

Link to post
Share on other sites

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

Link to post
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.

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.

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...