Hi there again,
I am trying to use camerangles to show the location of interest.
The camera angle seems to work well if object is located near. However, I am having trouble to move camera to a place of interest around 500m away and also behind a mountain. Is there a way to make camera avoid the mountain and also show the object with correct camera angle?.
Cheers
Control Camera Sequence Path
Re: Control Camera Sequence Path
Hi,
The Camera() sequencer command does a linear interpolation from the start point to the end point. This means it will move in a straight line.
Here are two options:
1. Use a cutscene editor like SLATE, Cinema Director, uSequencer, or Animator Timeline Editor to define a more complex path around the mountain. You can mix and match Dialogue System sequencer commands and edited cutscenes, only using edited cutscenes where they make life easier for you.
2. Or create empty GameObjects to act as waypoints around the mountain, and string Camera() commands together to follow the waypoints. For example, say you've defined these waypoints at the corners of the mountain: Southwest, Northwest, and Northeast. You want the camera to move from south of the mountain to its northeast corner without going straight through it. You could use this sequence:
Or, if you want to avoid doing the math, you can use ->Message and @Message syntax:
The Camera() sequencer command does a linear interpolation from the start point to the end point. This means it will move in a straight line.
Here are two options:
1. Use a cutscene editor like SLATE, Cinema Director, uSequencer, or Animator Timeline Editor to define a more complex path around the mountain. You can mix and match Dialogue System sequencer commands and edited cutscenes, only using edited cutscenes where they make life easier for you.
2. Or create empty GameObjects to act as waypoints around the mountain, and string Camera() commands together to follow the waypoints. For example, say you've defined these waypoints at the corners of the mountain: Southwest, Northwest, and Northeast. You want the camera to move from south of the mountain to its northeast corner without going straight through it. You could use this sequence:
Code: Select all
Camera(Southwest,,1);
Camera(Northwest,,1)@1;
Camera(Northeast,,1)@2
Code: Select all
Camera(Southwest,,1)->Message(AtSouthwest);
Camera(Northwest,,1)@Message(AtSouthwest)->Message(AtNortheast);
Camera(Northeast,,1)@Message(AtNortheast)
Re: Control Camera Sequence Path
Thanks Tony.
Tried the following option, seems to be working, but as camera moves towards the object, it flips and changes to Down. In a close distance it works fine, but the longer the distance, it flips in negative direction.
Camera(Southwest,,1);
Camera(Northwest,,1)@1;
Camera(Northeast,,1)@2
Tried the following option, seems to be working, but as camera moves towards the object, it flips and changes to Down. In a close distance it works fine, but the longer the distance, it flips in negative direction.
Camera(Southwest,,1);
Camera(Northwest,,1)@1;
Camera(Northeast,,1)@2
Re: Control Camera Sequence Path
Are those empty GameObjects oriented correctly? If Northwest, for example, is positioned correctly but is facing down, then the camera will end up looking down. It could be some of kind floating point accuracy across long distances. Does it help to add more waypoints along the way?
For what it's worth, this is the exact code that it's using to move the camera over time:
In other words, at every frame it moves the camera somewhere between the original state and the target state based on how long it's been moving.
Please feel free to send an example project or example scene to tony (at) pixelcrushers.com if you want, and let me know what version to Unity to use.
For what it's worth, this is the exact code that it's using to move the camera over time:
Code: Select all
cameraTransform.rotation = Quaternion.Lerp(originalRotation, targetRotation, elapsed);
cameraTransform.position = Vector3.Lerp(originalPosition, targetPosition, elapsed);
Please feel free to send an example project or example scene to tony (at) pixelcrushers.com if you want, and let me know what version to Unity to use.
Re: Control Camera Sequence Path
Ok its working now after playing around with object positions. They were new object so i though they were oriented correctly, but apparently camera though they were not.
Thanks for your help.
Thanks for your help.
Re: Control Camera Sequence Path
Happy to help!