Skip to content

Commit

Permalink
Merge pull request #65 from sorskoot/fix-orbital-cam-issues
Browse files Browse the repository at this point in the history
Fix orbital cam issues
  • Loading branch information
Squareys authored Sep 10, 2024
2 parents 5ab1430 + 7833164 commit 57de9bc
Show file tree
Hide file tree
Showing 4 changed files with 1,056 additions and 2,680 deletions.
2 changes: 1 addition & 1 deletion input-profile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ export class InputProfile extends Component {
* @param event The XR input source change event.
* @hidden
*/
private _onInputSourcesChange(event: XRInputSourceChangeEvent) {
private _onInputSourcesChange(event: XRInputSourcesChangeEvent) {
if (this._isModelLoaded() && !this.mapToDefaultController) {
this._setComponentsActive(false);
}
Expand Down
5 changes: 3 additions & 2 deletions orbital-camera.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ export class OrbitalCamera extends Component {
}

start(): void {
this._polar = Math.min(this.maxElevation, Math.max(this.minElevation, this._polar));
this._updateCamera();
}

Expand All @@ -78,7 +79,7 @@ export class OrbitalCamera extends Component {
if (this.mouseButtonIndex === 2) {
canvas.addEventListener('contextmenu', preventDefault, {passive: false});
}

canvas.addEventListener('mousedown', this._onMouseDown);
canvas.addEventListener('wheel', this._onMouseScroll, {passive: false});

Expand Down Expand Up @@ -159,7 +160,7 @@ export class OrbitalCamera extends Component {
const directionToCamera = vec3.create();
vec3.subtract(directionToCamera, position, this._origin as vec3);
vec3.normalize(directionToCamera, directionToCamera);

/* Scale this direction by the radius of your orbital sphere to get the nearest point on the sphere */
const nearestPointOnSphere = vec3.create();
vec3.scale(nearestPointOnSphere, directionToCamera, this.radial);
Expand Down
Loading

0 comments on commit 57de9bc

Please # to comment.