VKC Item Camera
VKC Item Camera is used to switch camera controls for visual purposes.
Using this component, camera can be switched in occasions such as event cut scenes, special camera works, and more purposes.
Switching camera will be done by HeliScript as explained later.
Available methods for this object type
Settings
Label | Initial Value | Function |
---|---|---|
Show | true | Enable this if you want the item to display by default |
Advanced
Label | Initial Value | Function |
---|---|---|
Auto Loading | true | When enabled, this Item will be loaded automatically on world entrance. As this Item must be explicitly loaded when Auto Loading is disabled, use Dynamic Loading or use Load() on HeliScript. |
Clickable | false | Toggles acceptance of click input from player |
Item Render Priority | 0 | Designates the Item's render priority. For details, refer to RenderingSettings / Priority List |
Show Photo Mode | true | Toggles display/hide item when in photo mode |
Usage
1. Create an empty GameObject and attach the VKC Item Camera component to place in scene.
As this object will be treated as a different Item than VKC Item Field, this can be placed outside the World object.
2. Implement the HeliScript for controlling camera
The object with VKC Item Camera attached will be output as an Item.
Therefore, Item class functions such as SetPos and SetQuaternion can be applied, added to Camera Functions.
Camera Functions
-
bool SetCamera()
Sets camera to the designated camera item.
Return value is true if switching has succeeded, false if failed. -
void ResetCamera()
Resets camera to the default camera following the player.
For example, the HeliScript using functions above is written as follows:
component EventCameraTest
{
Item m_Camera;
bool is_evented;
float Timer;
public EventCameraTest()
{
m_Camera = hsItemGet("CameraObj");
is_evented = false;
}
public void Update()
{
Timer += 10*hsSystemGetDeltaTime();
m_Camera.SetPos(makeVector3(7*hsMathSin(DEGtoRAD(Timer)),2,7*hsMathCos(DEGtoRAD(Timer))));
m_Camera.SetQuaternion(makeQuaternionYRotation(DEGtoRAD(Timer + 180)));
}
public void ChangeCamera(string dummy){
is_evented = !is_evented;
if(is_evented){
m_Camera.SetCamera();
}else{
m_Camera.ResetCamera();
}
}
}
The scene implementing this script is as the image below.
When the defined event camera is enabled, camera will pivot around the world center.
On the image below, the Sphere object has a CallScript attached to switch camera when clicked.
Other Tips
The event camera has characteristics as following:
- Player control will be affected by camera
- When POV is switched to 1st person view, player will warp to the camera position
Therefore, it is advised to constraint UI / player controls while event camera is enabled to prevent unexpected movements.