Merge pull request #1654 from thecodingmachine/feature-camera-management

Feature camera management
This commit is contained in:
David Négrier 2022-01-14 11:57:05 +01:00 committed by GitHub
commit 82c2d21423
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 639 additions and 131 deletions

View file

@ -21,4 +21,4 @@ Example :
```javascript
const subscription = WA.camera.onCameraUpdate().subscribe((worldView) => console.log(worldView));
//later...
subscription.unsubscribe();
subscription.unsubscribe();

View file

@ -58,6 +58,27 @@ WA.onInit().then(() => {
})
```
### Get the position of the player
```
WA.player.getPosition(): Promise<Position>
```
The player's current position is available using the `WA.player.getPosition()` function.
`Position` has the following attributes :
* **x (number) :** The coordinate x of the current player's position.
* **y (number) :** The coordinate y of the current player's position.
{.alert.alert-info}
You need to wait for the end of the initialization before calling `WA.player.getPosition()`
```typescript
WA.onInit().then(() => {
console.log('Position: ', WA.player.getPosition());
})
```
### Get the user-room token of the player
```