Change camera.setTarget

Hello everyone. I have created a scene where you can rotate the sphere using the middle mouse button. In addition, you can change the camera’s view using the right mouse button. The question is, how do I increase the speed of changing camera.SetTarget.

Hello and welcome :slight_smile:

On my side nothing happens since BABYLON.PointerEventTypes.RIGHT is not define, to you mean 2 ?


Also, what exactly do you want to achieve here ?
Calling camera.setTarget() on a pickedPoint from the scene.onPointerMove event might not be the best idea since as soon as the camera as changed, the point under the pointer will change as well, ending in somekind of infinite loop…

++
Tricotou

If you hold down the right mouse button and start moving the mouse, the camera’s view will shift. I need to achieve a higher rate of view change.

It does shift, but it’s not due to your code.
Have a look at this Playground where I totally removed your scene.onPointerDown, scene.onPointerUp, and scene.onPointerMove : it’s exatly the same :slight_smile:


The camera here is moving due to its panning (Arc Rotate moving in the plane of the view)
It’s very slow because your camera is very far from target.
You can adjust the panning sensibility using camera.panningSensibility = 20; for example
It results in this Playground

++
Tricotou

1 Like