|
This is a simple little function which allows you to tell the player and/or his camera to instantly turn to face a target object. It's main use is as part of the GestaltCameraTrack function, but you can use it by itself. Here's an example -
#include "in_g_cutscene"
void main()
{
object oPC = GetFirstPC();
object oTarget = GetObjectByTag("target");
GestaltCameraFaceTarget (oTarget
5.0, 50.0,
oPC,
0, 0);
}
Here's how you set the bit inside the brackets -
This means that the example script above is turning the selected player's camera to face a target object with the imaginative tag "target", simultaneously zooming the camera in close-up to the player and down close to the ground (50 degrees from the vertical). Here are a couple more sample scripts to get your teeth into -
#include "in_g_cutscene"
void main()
{
object oPC = GetFirstPC();
object oTarget = GetObjectByTag("target");
GestaltCameraFaceTarget (oTarget
-1.0, 50.0,
oPC,
1);
}
This is exactly the same as the first target script, except that this time we are leaving the camera's distance from the player untouched. However far away the player had the camera at the time the function was called, it will stay there - only the tilt and direction of the camera will be changed. Also note that we've set iFace to 1, which means that the player and his camera will be turned together so that they both face the target object.
#include "in_g_cutscene"
void main()
{
object oPC = GetFirstPC();
object oTarget = GetObjectByTag("target");
GestaltCameraFaceTarget (oTarget
-1.0, -1.0,
oPC,
2, 1);
}
And finally here's an example of a script that will turn only the player's character but not his camera, by setting the final number to 2. As we're not moving the camera at all, we've left both of the camera controls at -1.0. We've also set iParty to 1, which means that all of the other players in the selected player's party will turn to face the object as well.
|