Jump to content
This forum will be closing down. Please move to the respective dedicated project forums.

Search the Community

Showing results for tags 'beta axis'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Frameworks
    • Pixi.js
    • Phaser 3
    • Phaser 2

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Twitter


Skype


Location


Interests

Found 1 result

  1. Hello everyone, I'm currently building an object viewer with BJS that utilizes a single ArcRotateCamera. I had to create manual control buttons for the camera, because apparently it can't be expected of the average web user to know how the simple concept of drag and drop works. So, I built 6 button to rotate the camera up, down, left and right and zoom in and out. The beta axis needed some special attention, because the application's state machine can have a state where upperBetaLimit and lowerBetaLimit are null, so the user can rotate past the top / bottom. This works fine with the mouse, but when the button is used and the last rotation modification moves the beta value past zero/360 degrees, the camera's z-axis (which should be fixed and not even modifiable for ArcRotateCamera) flips upside down for a split second before some sort of internal correction seems to turn it back around to normal. But that moment is very irritating and I doubt that my client will approve the app with such an ugly display bug. Any idea what might be causing it and how to get rid of it? I already tried to prevent the beta value from ever reaching exactly zero, because I expected that this was the problem, but as it turned out, that was not it. Here is the code for the up button: $('#buttonRotateUp').on('mousedown touchstart', function (e) { e.preventDefault(); if (window.camBetaRotationInterval) { clearInterval(window.camBetaRotationInterval); } $('#buttonRotateDown').removeClass('limit-reached'); if (!$(this).hasClass('pressed') && !$(this).hasClass('limit-reached')) { $(this).addClass('pressed'); var rotateStep = 0.15; // checking if the limits are not null if ((scene.activeCamera.lowerBetaLimit || scene.activeCamera.lowerBetaLimit === 0) && scene.activeCamera.upperBetaLimit && (scene.activeCamera.beta + rotateStep) > scene.activeCamera.upperBetaLimit) { $('#buttonRotateUp').addClass('limit-reached'); scene.activeCamera.beta = scene.activeCamera.upperBetaLimit; } else { if ((scene.activeCamera.beta + rotateStep) == 0.0) { scene.activeCamera.beta += (rotateStep + 0.1); } else { scene.activeCamera.beta += rotateStep; } } window.camBetaRotationInterval = setInterval(function () { var $btn = $('#buttonRotateUp'); var rotateStep = 0.015; if ($btn.hasClass('limit-reached') || ((scene.activeCamera.lowerBetaLimit || scene.activeCamera.lowerBetaLimit === 0) && scene.activeCamera.upperBetaLimit && (scene.activeCamera.beta + rotateStep) > scene.activeCamera.upperBetaLimit)) { $btn.addClass('limit-reached'); scene.activeCamera.beta = scene.activeCamera.upperBetaLimit; } else { if ((scene.activeCamera.beta + rotateStep) == 0.0) { scene.activeCamera.beta += (rotateStep + 0.01); } else { scene.activeCamera.beta += rotateStep; } } }, 25); } }).on('mouseup touchend', function (e) { e.preventDefault(); $(this).removeClass('pressed'); if (window.camBetaRotationInterval) { clearInterval(window.camBetaRotationInterval); } });
×
×
  • Create New...