masterdon Posted January 22, 2018 Share Posted January 22, 2018 Hi Team, I am using arc rotate camera in the scene. There is delay/animation in panning when pressed control+drag. I want the panning to happen on the go without delay. I am trying to modify the native library code for arc rotate camera, but the snippet itself is loaded with delay. Is there a way to disable delay/animation in panning effect? if (this.inertialPanningX !== 0 || this.inertialPanningY !== 0) { console.log('Start Drag---------------') console.log(new Date()) if (!this._localDirection) { this._localDirection = BABYLON.Vector3.Zero(); this._transformedDirection = BABYLON.Vector3.Zero(); } this.inertialPanningX *= this.inertia; this.inertialPanningY *= this.inertia; if (Math.abs(this.inertialPanningX) < BABYLON.Epsilon) this.inertialPanningX = 0; if (Math.abs(this.inertialPanningY) < BABYLON.Epsilon) this.inertialPanningY = 0; this._localDirection.copyFromFloats(this.inertialPanningX, this.inertialPanningY, this.inertialPanningY); this._localDirection.multiplyInPlace(this.panningAxis); this._viewMatrix.invertToRef(this._cameraTransformMatrix); BABYLON.Vector3.TransformNormalToRef(this._localDirection, this._cameraTransformMatrix, this._transformedDirection); //Eliminate y if map panning is enabled (panningAxis == 1,0,1) if (!this.panningAxis.y) { this._transformedDirection.y = 0; } if (!this.target.getAbsolutePosition) { this.target.addInPlace(this._transformedDirection); } console.log(new Date()) console.log('End Drag---------------') } also tried setting various values to speed, panningSensibility, cameraAcceleration. Quote Link to comment Share on other sites More sharing options...
RaananW Posted January 22, 2018 Share Posted January 22, 2018 Howdy! So, not sure what you mean actually. If there is a certain delay, it is max a single frame (ca. 16 ms) since the event data is not retrieved when the render loop is running. In reality, it is probably much less than 16ms. Where exactly do you see delay in the code? If there is, it is probably unintentional and should be removed. Quote Link to comment Share on other sites More sharing options...
masterdon Posted January 22, 2018 Author Share Posted January 22, 2018 @RaananW: Thanks a lot for quick reply I want to have panning and zooming happening quickly. without smooth effect Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted January 22, 2018 Share Posted January 22, 2018 You should just set camera.inertia = 0 to remove the smooth effect Quote Link to comment Share on other sites More sharing options...
RaananW Posted January 22, 2018 Share Posted January 22, 2018 What he said! Quote Link to comment Share on other sites More sharing options...
masterdon Posted January 22, 2018 Author Share Posted January 22, 2018 That works for zoom in/out. but panning isn't working any more here is the cam code scene = new BABYLON.Scene(engine); camera1 = new BABYLON.ArcRotateCamera("Camera1", 1.57, 0.01, 120, new BABYLON.Vector3(0, -0.4, 10), scene); camera1.attachControl(canvas, true); // This targets the camera to scene origin //camera1.setTarget(new BABYLON.Vector3.Zero()); //set camera position camera1.setPosition(new BABYLON.Vector3(0, 200, 11)); //set zoom limit camera1.inputs.attached['keyboard'].detachControl(canvas); camera1.lowerRadiusLimit = 40; camera1.upperRadiusLimit = 160; camera1.checkCollisions = true; if (!is3D) { //limit the arcCam alpha and beta (essentially to disabled the rotation). camera1.upperAlphaLimit = -Math.PI / 2; camera1.lowerAlphaLimit = -Math.PI / 2; camera1.upperBetaLimit = 0; camera1.lowerBetaLimit = 0; } camera1.inertia = 0 //camera1.speed = 500 scene.activeCamera = camera1; scene.activeCamera.attachControl(canvas, true); Quote Link to comment Share on other sites More sharing options...
Gijs Posted January 22, 2018 Share Posted January 22, 2018 You should set the panning inertia to 0: camera1.panningInertia = 0; Quote Link to comment Share on other sites More sharing options...
masterdon Posted January 22, 2018 Author Share Posted January 22, 2018 Hey Gijs. Its not working. tried all combination for values camera1.inertia = 0 camera1.panningInertia = 0; Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted January 23, 2018 Share Posted January 23, 2018 Can you repro in the playground? 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.