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

Allow access to methods to control the camera in VR (the camera or scene methods) #54

Open
dianafonte opened this issue Dec 4, 2024 · 1 comment

Comments

@dianafonte
Copy link

I need to focus on a node and reset the view to the starting point programmatically. At this moment this is not possible in VR because the library does not expose the camera, scene, renderer or controls methods.

I would like for these methods to be accessible, so I can change the camera's position.

@vasturiano
Copy link
Owner

@dianafonte thanks for reaching out.

These items are not exposed because in VR/A-Frame mode the environment is not quite the same as for WebGL/ThreeJS.

This component offers a simple use case of the force-graph A-Frame component. For more sophisticated cases, you can always use the aframe-forcegraph-component and setup the A-Frame scene/camera/controls scaffolding yourself. I'd suggest this approach if your case is custom.

An alternative option, albeit slightly hacky, is to manipulate the A-Frame monitored DOM elements. For instance, to modify the camera position using this method, you can do something like:

document.querySelector('a-entity[camera]')
  .setAttribute('position', '0 0 300')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants