Does the Orbit controls have controls.enableDoubleClick to change the target?

Hi there!

I have found this code mentioned but its not in the orbit control documentation. Is this possible?

controls.enableDoubleClick = true;

I would like to use this function to be able to double click in the scene to change the target of the orbit camera to this new postion I have clicked. I know that Scetchfab does this but they are doing something with the structure of the object and that each piece of the object can be referenced to then change the target.

I’m not sure that’s possible out of the box but you could make use of the dblclick event listener which in turn could wrap and utilise the typical method of raycasting to apply the clicked objects position to the control.target…

1 Like

Here is 1 example.
It uses tween to smoothly transition to the next target on dblclick.
See line 61-87 in TS code, or view JS version by pressing <> in the working example.
OrbitControls Double Click : https://sbcode.net/threejs/tween-orbit/
image

3 Likes

Thank you both for your responses!

Im going to have to take a look at the rest of your tutorials Sean. Thank you!

1 Like