Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

link component: allows setting previewDistance #4425

Merged
merged 8 commits into from
Nov 21, 2024

Conversation

DougReeder
Copy link
Contributor

Description:
For the link component, allows setting the distance within which the preview image is shown. The default is good for standard size portals used when virtually walking, but the larger portals required by higher speeds (or cyclopean architecture) need to let the preview image be seen at a greater distance. See https://elfland-glider.surge.sh/yggdrasil/

Changes proposed:

  • The default is 15m, as before, so this will have zero effect on links that don't set the previewDistance attribute.
  • Can also be set on the a-link primitive, as preview-distance.
  • In the link-traversal example, the center link has its previewDistance doubled.

@DougReeder
Copy link
Contributor Author

The tests are failing in CI because "apt-get install failed". They all pass on my machine.

src/components/link.js Outdated Show resolved Hide resolved
@dmarcos
Copy link
Member

dmarcos commented Feb 4, 2020

Thanks. I think if anything this could be automated instead of adding additional properties to the component

@DougReeder
Copy link
Contributor Author

Does the current PR meet your standards?

src/components/link.js Outdated Show resolved Hide resolved
@@ -199,7 +205,7 @@ module.exports.Component = registerComponent('link', {
cameraWorldPosition.setFromMatrixPosition(camera.matrixWorld);
distance = elWorldPosition.distanceTo(cameraWorldPosition);

if (distance > 20) {
if (distance > this.previewDistance + 5) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why + 5 and not making previewDistance 25?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left the functionality unchanged, when the scale is unchanged.

The original code in master shows the preview when the camera is closer than 15m, and turns the link to face the camera when the camera is farther than 20m (you could call that the "link-lookAt distance'). In between, the center of the link just shows red, but the link isn't turned to face the camera.

I vary the preview distance, rather than the link-lookAt distance, because neither should be zero or less. Also, the preview distance is used in several places in the code, and link-lookAt distance only one.

Any change in the relationship between these parameters or change to the behavior of links with scale 1, should be done in a different PR, I think.

@dmarcos
Copy link
Member

dmarcos commented Feb 13, 2020

Thanks for the patience. I made a few more comments.

@dmarcos
Copy link
Member

dmarcos commented Nov 21, 2024

Thank you!

@dmarcos dmarcos merged commit 8163478 into aframevr:master Nov 21, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants