Skip to content

Commit dd0ed55

Browse files
authored
Merge pull request #4 from ma2yama/marmot_setInitialPosition
Set initial position
2 parents ac94bbf + 3d2c0a4 commit dd0ed55

File tree

10 files changed

+24
-10
lines changed

10 files changed

+24
-10
lines changed

aframe/build/aframe-ar-new-location-only.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

aframe/build/aframe-ar-new-location-only.mjs

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

aframe/build/aframe-ar-nft.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

aframe/build/aframe-ar-nft.mjs

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

aframe/build/aframe-ar.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

aframe/build/aframe-ar.mjs

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

three.js/build/ar-threex-location-only.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

three.js/build/ar-threex-location-only.mjs

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

three.js/examples/location-based/index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ function main() {
1515

1616
// You can change the minimum GPS accuracy needed to register a position - by default 1000m
1717
//const arjs = new LocationBased(scene, camera, { gpsMinAccuracy: 30 } );
18+
19+
// You can set the initial position
20+
// const initialPosition = { longitude: 51.47816410406528, latitude: -0.001540203696240924 };
21+
// const arjs = new LocationBased(scene, camera, { initialPosition });
22+
1823
const cam = new WebcamRenderer(renderer, '#video1');
1924

2025
const mouseStep = THREE.MathUtils.degToRad(5);

three.js/src/location-based/js/location-based.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,17 @@ class LocationBased {
1313
this._maximumAge = 0;
1414
this._watchPositionId = null;
1515
this.setGpsOptions(options);
16-
this.initialPosition = null;
17-
this.initialPositionAsOrigin = options.initialPositionAsOrigin || false;
16+
this.initialPosition =
17+
options.initialPosition != null
18+
? this._proj.project(
19+
options.initialPosition.longitude,
20+
options.initialPosition.latitude,
21+
)
22+
: null;
23+
this.initialPositionAsOrigin =
24+
options.initialPosition != null ||
25+
options.initialPositionAsOrigin ||
26+
false;
1827
this.useAltitude = options.useAltitude || false;
1928
}
2029

0 commit comments

Comments
 (0)