Camera onFocus on Sprite

Hi,

I have a scene with multiple sprites and I would like the camera to rotate and face the sprite when the sprite is clicked. Is it possible to set ArcRotateCamera facing a sprite when the sprite is clicked? Tried onFocus but it seems like it works only on mesh. Any suggestions is much appreciated!

This doc is explaining how to do picking with sprites:

Thanks for the response, but my concern is how to rotate the camera to face the sprite as these sprites are in placed in a 360 photoDome.

https://playground.babylonjs.com/#14KRGG#492

Sharing the playground, where there is a icon so onclick of the icon the camera’s alpha and beta angle should be changed similar to how camera.onFocus works.

Here’s something that works more or less:

https://playground.babylonjs.com/#14KRGG#493

I have copied the rebuildAnglesAndRadius function of the ArcRotateCamera class and removed the radius updating.

It works more or less because it does not move the focus right at the center of the screen but a bit offseted, but I don’t know why…

2 Likes

Thanks for the solution, will go through the function and will try to understand it. :smiley:

2 Likes