Rotate-to-cursor on touch events

for example on google earth, I press middle of mouse to move, the earth rotate width the touch event, so I want all scene rotate to middle mouse, when using threejs. How can I do? Please help me code it, thanks

If you’re using OrbitControls, you can assign middle mouse button to rotation - see docs.

yes, I’m using OrbitControls. I knew middle mouse button to rotation,
controls.mouseButtons = {
LEFT: THREE.MOUSE.PAN,
MIDDLE: THREE.MOUSE.ROTATE,
RIGHT: THREE.MOUSE.DOLLY
}
. but the scene rotates width controls.target, I want the scene rotate with mouse position of pressing.

Aaah - you can use a raycaster and cast against the objects in the scene when mouse is pressed. Then set controls.target to intersections[0].point - that should make the camera revolve around the cursor position.

this is online code, please have a look. when pressing middle mouse on the box, the box go to the center of scene. I still hope it stay its original position to rotate. you can try the performance on google earth https://earth.google.com/web/@0,0,0a,22251752.77375655d,35y,0h,0t,0r