Replies: 1 comment 2 replies
-
@trusktr , good to see you again and thanks for the discussion point. Have you seen: https://www.harp.gl/docs/master/examples/#getting-started_free-camera.html ? It is however non-trivial to implement. It shows how to setup a camera to look at the main camera, though there are issues with the labelling, that would need to be fixed. I also see there is some issue with the far plane for the buildings, so that would need to be looked at (well depending on the use case). But I'm not sure if that would handle the use cases you are interested. If I look at the example, it seems you need to manage the near / far plane yourself and it would open up some tricky scenarios. To be able to put harp.gl into an existing scene would be awesome. It should definitely be doable it would just need to be seen how much effort it would be. See also: This is the class which handles placing the objects relative to the "relative to eye" camera we have. |
Beta Was this translation helpful? Give feedback.
-
By default the Harp.gl framework makes and manages a Three.js scene that users can stick Three.js objects into.
I'm curious about integrating Harp.gl into existing Three.js Is there a way to do this, the other way around?
An example use case could be, for example, there may be an existing space scene, and we wish to put multiple planets into that scene.
It could be a game, or an interactive galaxy map, etc. The developer can make a space scene, then they can decide where and how to move a Three.js camera. The app could, for example, pan from one planet to another, and essentially this could cause the app to trigger different Harp.gl instances inside the same universe based on where the camera is. Imagine panning from Earth, to Mars.
Or for example, imagine an existing first person shooter, and the developer wants to add a feature where the camera can be changed to 3rd person and then zoomed out to show the whole world (with tiling and level of detail from Harp.gl). This could perhaps be used in an infinite universe game or experience. Or in the opposite direction, imagine the user zooms into a planet, clicks on a character that is walking on that planet, then goes into full first-person control of that character. The character could be a game player, or perhaps a NASA rover on a science mission, etc.
Etc. Etc.
The main ask is to see whether it is possible to stick Harp.gl into existing Three.js scenes, and for Harp.gl to recognize the custom
Camera
and do it's calculations based on that. Ideally Harp could be used as a library within any sort of Three app.That would be great, but if that isn't possible (maybe because Harp's encapsulation of the Three scene is tightly coupled with internals such that Harp has to own the scene for it to work well), then is there an alternative way to implement multiple planets in one Harp scene, and to change the camera control format (f.e. changing to first person controls, then back to Harp map controls)?
Beta Was this translation helpful? Give feedback.
All reactions