Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ArcRotateCamera: Modify rotation logic to use invertRotation flag #12762

Merged
merged 3 commits into from
Jul 19, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions packages/dev/core/src/Cameras/arcRotateCamera.ts
Original file line number Diff line number Diff line change
Expand Up @@ -911,6 +911,7 @@ export class ArcRotateCamera extends TargetCamera {
this.inputs.checkInputs();
// Inertia
if (this.inertialAlphaOffset !== 0 || this.inertialBetaOffset !== 0 || this.inertialRadiusOffset !== 0) {
const directionModifier = this.invertRotation ? -1 : 1;
let inertialAlphaOffset = this.inertialAlphaOffset;
if (this.beta <= 0) {
inertialAlphaOffset *= -1;
Expand All @@ -921,9 +922,9 @@ export class ArcRotateCamera extends TargetCamera {
if (this.parent && this.parent._getWorldMatrixDeterminant() < 0) {
inertialAlphaOffset *= -1;
}
this.alpha += inertialAlphaOffset;
this.alpha += inertialAlphaOffset * directionModifier;

this.beta += this.inertialBetaOffset;
this.beta += this.inertialBetaOffset * directionModifier;

this.radius -= this.inertialRadiusOffset;
this.inertialAlphaOffset *= this.inertia;
Expand Down