Hello everyone
I want to know how can I move the camera to the mouse pointer when I db click anywhere on the scene, for the meshes it is work properly and when db clicked on the meshes the camera zoom in to the target but also I want to zoom the camera to other region of the scene where there is no mesh, so I want to know how can I move the camera to the direction of the mouse pointer automatically not with mouse scroll wheel. how can I do it? (with the aid of mouse scroll wheel I can zoom to the mouse pointer)
Here is my code:
camera.zoomToMouseLocation = true;
scene.onPointerObservable.add((evt, pointerInfo) => {
var pickResult = scene.pick(scene.pointerX, scene.pointerY);
if (evt.pickInfo.hit) {
var pickPoint = pickResult.pickedPoint
var impact = new BABYLON.AbstractMesh("impact", scene)
impact.position = new BABYLON.Vector3(pickPoint.x, pickPoint.y, pickPoint.z);
gsap.to(camera.target,2,{x:pickPoint.x ,y:pickPoint.y,z:pickPoint.z})
}
var impact = new BABYLON.AbstractMesh("impact", scene)
impact.position = pickResult.ray.direction
gsap.to(camera.setTarget,1,{x:impact.position.x ,y:impact.position.y,z:impact.position.z})
gsap.to(camera, 2, { radius: 50 });
}, BABYLON.PointerEventTypes.POINTERDOUBLETAP)
and here is my PG: https://playground.babylonjs.com/#Q8VH3H#17