How can I put a little space between camera and the target in Universal camera?

Hello everyOne

here is my PG:
if you dbclicked on the meshes the camera start move to the target and then pass the impact sphere, how can I stop the camera just before the impact sphere? I mean I want always the impact sphere be in front of the camera

You can offset the point by the sphere radius + the camera minZ distance:

1 Like

Hi @Evgeni_Popov Thanks a lot, You are great. :pray: :pray: :pray:

sorry, is it possible to ask another question? how can set the impact always to the center of the camera, because I think the setTarget doesn’t work in Universal Camera.

I reused the setTarget code from the camera class to compute a final orientation (quaternion) to reach and interpolated between the current and the final ones:

I don’t know if gsap can interpolate between quaternions, so I used the existing Quaternion.Slerp function of Babylon.


You are Greattt. Thank you so much @Evgeni_Popov :pray: :pray: :pray: