Skip to content

Commit

Permalink
Zappar for PlayCanvas v1.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Zappar committed Jan 31, 2022
1 parent 0fe6ec4 commit d258c2c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## [1.1.1] - 2022-01-31

### Fixed

- Some camera projection matrix properties not being copied over to PlayCanvas. Thanks [yaustar](https://forum.playcanvas.com/t/zap-ar-image-target-buttons-not-work-in-protrait-mode/22964/6)


## [1.1.0] - 2022-01-07

### Added
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ You may also be interested in:
* [PlayCanvas](#playcanvas)
* [Links and Resources](#links-and-resources)

<!-- Added by: zapparadmin, at: Fri Jan 7 15:34:20 GMT 2022 -->
<!-- Added by: zapparadmin, at: Mon Jan 31 11:25:09 GMT 2022 -->

<!--te-->
</details>
Expand Down
11 changes: 9 additions & 2 deletions src/Zappar/scripts/zapparCamera.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,9 +289,16 @@ ZapparCamera.prototype.update = function () {
/**
* Override default camera's projection matrix with one provided by Zappar.
*/
if (this.entity.camera) {
this.entity.camera.calculateProjection = (mat) => {
const camera = this.entity.camera;
if (camera) {
camera.calculateProjection = (mat) => {
mat.copy(projectionMatrix);
const data = projectionMatrix.data;
camera.horizontalFov = false;
camera.fov = (2.0 * Math.atan(1.0 / data[5]) * 180.0) / Math.PI;
camera.aspectRatio = data[5] / data[0];
camera.farClip = data[14] / (data[10] + 1);
camera.nearClip = data[14] / (data[10] - 1);
};
}
};

0 comments on commit d258c2c

Please sign in to comment.