setTarget with FreeCamera is not working: not taking my values

Hey there, I have a problem with setTarget. (sorry for my english )
So to sum up, I am developping an application which create Virtual Tour with BabylonJS.
In my creation part of the visit I have a button that can fixe the camera so when I am coming in that scene, the camera is looking at somewhere I wanted to. Here is the picture:

Here you can see my function setTarget is working, I want to look at here when I am coming in this scene.

So I pick up the value of the target, and I push into a JSON.

Then in this app, we can see the preview of the virtual Tour, and it’s there my setTarget is not working.

You can see that I am not looking at the right direction.

Here is my code I am using in this part of the app:


So When I am looking at the console, the vector lookAtCamera is picking the right values, but anyway setTarget is not working.


vecteur = value of lookAtCamera and camera = camera.getTarget().
As you can see, my vector lookAtCamera has the right values but it’s like if the camera is not taking these values… Do you have any idea why it’s not working there ? Because it’s not like it’s not working at all ^^ It’s working in my first picture

setTarget takes a 3D location in space, not a yaw/pitch/fov triplet as your code seems to show.

Also, fov is quite strange, you wanted to put roll instead? Maybe it’s your bug, but then the namings of your variables are misleading.

Don’t worry, its juste name, it’s not pitch, yaw, and fov, it’s real value, it’s just a former name that I am not using anymore. So I use these name because I don’t want to create another line in my data base tha’s all ^^

Well, then except asking you if you are double sure that the values you pass to setTarget are the same between the scene where it works and the scene where it does not work, it’s difficult to say more without a playground or a link to your live scene.

Yeah I am sure, I put value like new BABYLON.Vector3(0,5,0) and nothing happened.
So I have tried something. I did some class in my code : Scene (where we create the object scene, camera + VrExperience ) . A class Photo where I am creating each domPhoto 360. I want to put my setTarget in my class Photo who is a child class of Scene, It’s not working, but when I am putting my setTarget into my Scene class, it’s working ^^ I will try something else, because I am not destroying the object scene of babylon because the VrExperienceHelper is created with it ^^ so I am destroying domPhoto each Time I want to move. But in the creation part of the visit where it works, I put setTarget into my Photo class ^^