google-ar / three.ar.js

A helper three.js library for building AR web experiences that run in WebARonARKit and WebARonARCore
https://developers.google.com/ar/develop/web/getting-started
Apache License 2.0
2.91k stars 365 forks source link

The explanation about `updateProjectionMatrix()` #85

Closed ega1979 closed 6 years ago

ega1979 commented 6 years ago

The explanation about getProjectionMatrix exists at API.md. However, getProjectionMatrix itself is not used in all example and only updateProjectionMatrix is used in examples. But updateProjectionMatrix is not explained about at API.md. I understand getProjectionMatrix() is used in updateProjectionMatrix(). So, what does it mean updateProjectionMatrix()?

And, where should I refer to 'projectionMatrix' property at three.ar.js. It seems not to be exist.

lincolnfrog commented 6 years ago

getProjectionMatrix is a way for you to get the projection matrix if you want to use that information in your app. We don't currently have an example that needs to do math based on the projection matrix. updateProjectionMatrix() is what you call if the projection matrix needs to be recalculated - you can see in the examples it gets called when the near/far planes or device orientation changes. Most of the time the projection matrix is set at the beginning and doesn't need to be updated after that (unless the device orientation changes).

camera.projectionMatrix does indeed exist.

jsantell commented 6 years ago

The ARPerspectiveCamera inherits from three's PerspectiveCamera -- using updateProjectionMatrix on ARPerspectiveCamera is used in the same way; and like @lincolnfrog said, shouldn't be necessary most likely