I have looked through the forum threads but cant find my answer and hence the question.
I want to move the camera when an event is triggered (say a collision). Looking at the DynamicCamera in the Inspector, I can see the following classes
Camera
CesiumCameraController and
CesiumFlyToController
But cant find a method which moves the camera. I tried LookAt, which then points to object but doesnt fly to it. Which method do I need to use to get close to the object?
Hi @zardtomcat, a camera can be moved in the same way as an other Unity object: by modifying its Transform.
If you’re looking to fly the camera to specific location (and orientation) on the globe, then the CesiumFlyToController can help with that. Take a look at the FlyToLocationLongitudeLatitudeHeight method on that class.
I’m not familiar with the UI in your screenshot (can you walk me through how you accessed that?), but the function is definitely in v1.12.0 when accessed via C# script. The link to the function that I shared previously is in that exact version.
Ok, no problems. The process is as follows:
I use Unity 3d and create an empty unity scene.
Using Cesium panel, I add a Dynamic Camera to my scene. The item is added to CesiumGeoreference.
I now add my 3d tiles for the area that I am interested in.
I add a button to my scene.
For that button I add the “Dynamic Camera” to “On Click” event.
This gives me access to all classes supported by Dynamic Camera.
I find the class I need
Thanks for the detailed walkthrough! This might be happening because the function takes more than one parameter. You can check out this StackOverflow thread for more details on what Unity requires for events:
Perhaps you could work around this by writing your own custom function / script that fits the criteria? That way you could set it as an event in the Unity UI.
I am not a unity C# programmer, although I can use the script.
I can use visual scripting, but I dont think there are hooks to Cesium in visual scripting.
Can you provide a C# script to call this function? I can then just pass the parameters to it to get it to work.