Hey there,
the orbit controls are already very handy to create a scene like the hotspot sample. But when I create an example case for internal testing, I still get some difficulties:
To orbit around a scene it works all well. I use the āChange Transform on Clickā Comp to move camera and lookAtTarget to another view (position/focus). To get this working I have to use the ālockā setting on the āLook At Constraintā Comp. Without it, panning the camera would offset the view in a bad way.
Now the left mouse button orbits the view, and the right mouse button (or two finger touch) also kind of, but slowly. It seem it still pans, but because it looks at same focus, it does not work anymore as expected.
Maybe itās more convenient, if we could bind the lookAt-target to the camera while panning (or apply the same translation to it), so that the pan again would work.
What do you think?
p.s.: Iām impressed, how fast I could setup an interactive scene with needles. Good work. Still struggling to understand so many web, typescript, compiling, npm, node, stuffā¦ which gives me headaches coming from the original engine workflow. Questions here already helped me and also documentation, but thereās a lot to rethink/relearn.
Thank you!
This was good input. I had not expected, to find the answer in this sample, and so I also had create my first typescript scriptsā¦ I feel newbie again.
OrbitControls.setTarget() and
OrbitControls.setCameraTargetPosition(ā¦);
ā¦did the trick for me, sending cam and focus to other positions while lock is enabled. This lead me to another problem, which is maybe also easy to solve: when the cam tweens to the new position, every user input stops the tween. How can I temporarily disable the input from OrbitControllerā¦ I disabled it, but then it is also not tweening. Disable āenableRotationā did also not helped.
I think the simplest is to just set the EnableRotation, EnableKeys, EnableZoom, EnablePan, MiddleClickToFocus and DoubleClickToFocus all to false and that should disable the cameraās user input.
With this in mind, there comes a more generic question in mind: how shall I handle such problems?
Try to solve it on my own?
Or discuss in this question section?
Due all these comps are organized in packages/cache, I already noticed, that changing them is not possible. I asume, I could copy them and modify and create my own version of it, but Iām also not sure, if this is feature proof solution for meā¦
In long term, I donāt want to annoy people with my small thoughts about optimizations, but I do user interactions too long not to have special wishes. On the other hand, it could be interesting for you as well to be proven on use cases.
Itās good to discuss it here! Often times those questions are very valid usecases and things we want to fix/improve in the components if possible (not always but thereās always a solution )
About the user input: thatās a good point and probably a case of āadding an option for itā
What you can always do to try or iterate/test is to copy the component and modify. We also have a couple of ways to adjust behaviour of existing components (e.g. with the @prefix decorator which can be used to override what a function does)
Itās possible to temporarely modify them as well but you have to change the code in the lib folder of the needle engine package for example (the js classes are used by default)
I tried this, but it seem not to work.
Input was possible after āstopListenā end if called again it throws: āUncaught TypeError: Cannot read properties of null (reading āremoveEventListenerā)ā - which is maybe kind of logic, but because I could still rotate the cam after stopping it may not work or I did something false.
Hereās my sandbox - Minimal
If user enters a POI area like the pictures and zoom out, he should go to home view. Kind of works, but often interrupted, from mouswheel, etc. In future I try the same, when āzoomingā to a POI - so thatās auto sets the lookAT. Also animation will be interesting to play with. As far until now, Iām happy with the progress. And also nice, that feedback hereās so fastā¦