Question about SetCameraFacing timing
![rjohnson674](https://forums.beamdog.com/applications/dashboard/design/images/defaulticon.png)
Hello!
Is there any documentation about how the SetCameraFacing function determines how fast to change the direction/distance/pitch values?
From trial-and-error, I can see that the direction change is using the Camera Transition Type value (_SLOW moves at a steady 20 degrees/second, _VERY_SLOW at 5 degrees/second, etc.), at least when I am only changing the direction.
The pitch changes at a slower speed: _SLOW seems to be around 10 degrees/second, but sometimes seems more like 9.7 or so degrees/second.
The camera also seems to sometimes slow down if it happens to pass through "architecture", though that might just be due to extra calculations.
Basically, when setting up a cutscene with camera movements, it would be very useful to be able to calculate how much time the camera will take to complete its movement.
Alternatively, if I could have the cutscene wait until the camera motion is finished before continuing, that would also work. I haven't had any luck getting this to happen, though - it seems like once the camera is in motion, it just keeps going until it stops.
Any help would be greatly appreciated!
Is there any documentation about how the SetCameraFacing function determines how fast to change the direction/distance/pitch values?
From trial-and-error, I can see that the direction change is using the Camera Transition Type value (_SLOW moves at a steady 20 degrees/second, _VERY_SLOW at 5 degrees/second, etc.), at least when I am only changing the direction.
The pitch changes at a slower speed: _SLOW seems to be around 10 degrees/second, but sometimes seems more like 9.7 or so degrees/second.
The camera also seems to sometimes slow down if it happens to pass through "architecture", though that might just be due to extra calculations.
Basically, when setting up a cutscene with camera movements, it would be very useful to be able to calculate how much time the camera will take to complete its movement.
Alternatively, if I could have the cutscene wait until the camera motion is finished before continuing, that would also work. I haven't had any luck getting this to happen, though - it seems like once the camera is in motion, it just keeps going until it stops.
Any help would be greatly appreciated!
0
Comments
For more control over the camera have you thought about using the (older) GestaltCamera Scripting System v2.0 or the (newer and expanded) Gestalt Cutscene Scripting System? If you decide to use the latter be aware that there is also an alternate set of instructions Gestalt Cutscene System - updated pdf by @jimdad55.
TR
The GestaltCameraCrane() function is the most general.
Since the camera timing is precisely specified, you can delay other actions to match.
These days, I wouldn't consider writing a cutscene with the vanilla functions, because the Gesalt system has already ironed out all the bugs for us.
When changing only the direction, the camera changes this angle at a steady rate equal to the value of the CAMERA_TRANSITION_TYPE_ constant passed to the function. So CAMERA_TRANSITION_TYPE_MEDIUM will have the direction change at 40 degrees per second. It moves in the shortest "distance" (clockwise or counterclockwise) to reach the target direction.
When changing only the pitch, the camera again changes the angle at a steady rate, though this rate is 22/45 times the value of the CAMERA_TRANSITION_TYPE_ constant. As this works out to 88/180, I believe this rate was chosen so that the maximum angle change takes the same time for both direction and pitch - with the default camera limits, the maximum direction change is 180 degrees and the maximum pitch change is 88 degrees (between 1 degree and 89 degrees).
When changing only the zoom distance, the camera moves exponentially, rather than linearly. In particular, Current distance = Start distance times a constant (seems to be about 1.0125) raised to an exponent that is the product of the CAMERA_TRANSITION_TYPE_ constant's value and the time that has passed since the motion started (use positive values for zooming out and negative values for zooming in). Going the other way, to calculate how long the camera needs to "zoom" from one distance to another, it is: time = (LOG(bigger distance) - LOG(smaller distance))/(CAMERA_TRANSITION_TYPE_ constant * LOG(1.0125)).
When changing more than one of the parameters (direction, zoom distance, pitch) at once, the function seems to calculate how long each change would take, and uses the longest one. The other rates of change are slowed down so that they all finish at the same time.
Finally, if the camera is still moving when a new SetCameraFacing command is issued, it immediately starts moving to the new angles/distance (does not finish the previous command).