-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6688867
commit e0d9518
Showing
3 changed files
with
80 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
pages/documentation/framework-overview/scene-and-animation/camera-operator.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
Camera Operator {#camera-operator} | ||
======================================== | ||
|
||
The **CameraOperator** component serves as a helper that manages camera-related functionality within a game engine. | ||
Its primary purpose is to track points in world space and update the camera’s position accordingly. | ||
By doing so, it ensures that the camera focuses on relevant areas or objects during gameplay. | ||
|
||
## How to Use | ||
|
||
When integrating the CameraOperator component into your game, consider the following aspects: | ||
|
||
- **Tracking Nodes (TrackNode, RemoveTrackedNode, RemoveAllTrackedNodes)**: | ||
The component allows you to track multiple scene nodes (such as objects or characters) in the game world. | ||
Use **TrackNode** to add a specific node to the list of tracked objects. | ||
If a node becomes irrelevant (e.g., an object moves out of view), remove it using **RemoveTrackedNode**. | ||
To clear all tracked nodes, call **RemoveAllTrackedNodes**. | ||
|
||
- **Bounding Box Tracking (IsBoundingBoxTrackingEnabled, SetBoundingBoxTrackingEnabled, GetBoundingBox)**: | ||
The boundingBoxEnabled_ flag determines whether bounding box tracking is active. | ||
By default, it’s disabled. | ||
If enabled, the component uses the specified bounding box (via SetBoundingBox) to determine the camera’s focus area. | ||
Adjust the bounding box to encapsulate the relevant scene region you want the camera to cover. | ||
|
||
- **Padding (SetPadding, SetUniformPadding, GetPadding)**: | ||
Padding ensures that the camera doesn’t focus too closely on the tracked objects. | ||
Use SetPadding to define padding in world space units. | ||
Alternatively, set uniform padding in all directions using **SetUniformPadding**. | ||
|
||
- **Camera Movement (MoveCamera)**: | ||
The MoveCamera method updates the camera’s position based on the tracked nodes and bounding box. | ||
It calculates the optimal camera position to include all relevant objects while considering padding. | ||
The camera position will be updated automatically every frame if the component is enabled but you can also disable component and call MoveCamera when you need to move the camera node and adjust camera parameters. | ||
|
||
Remember that the CameraOperator collaborates with other components (e.g., the actual camera component) to achieve the desired camera behavior. | ||
|
||
In summary, the CameraOperator component streamlines camera management by tracking nodes, adjusting camera position, and ensuring proper framing based on the specified bounding box and padding. It’s a valuable tool for enhancing gameplay visuals. |
42 changes: 42 additions & 0 deletions
42
pages/documentation/framework-overview/scene-and-animation/shake-component.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
Shake Component {#shake-component} | ||
======================================== | ||
|
||
The **ShakeComponent** is designed to create a camera shake effect in a game. It randomly displaces the position and rotation of a node (presumably representing the camera) around the origin (0,0,0) coordinate. This effect adds visual impact and realism to certain game events, such as explosions, impacts, or intense moments. | ||
|
||
## How to Use | ||
|
||
To use the ShakeComponent, you would typically attach it to a game object (like the main camera) that you want to shake. | ||
|
||
Here’s how you might use its features: | ||
|
||
- **Time Scale (SetTimeScale and GetTimeScale)**: | ||
The timeScale_ parameter acts as a multiplier for the Perlin Noise argument. | ||
Adjusting this value changes the speed and intensity of the camera shake. | ||
Higher values result in faster and more intense shaking. | ||
|
||
- **Trauma (AddTrauma, SetTrauma, and GetTrauma)**: | ||
The trauma_ value represents the current intensity of the shake. | ||
You can increase it using AddTrauma or directly set it with SetTrauma. | ||
The component uses this value to determine how much to shake the camera. | ||
|
||
- **Trauma Power (SetTraumaPower and GetTraumaPower)**: | ||
The traumaPower_ parameter controls the falloff rate of the shake effect. | ||
Higher values make the shake decay more slowly over time. | ||
|
||
- **Trauma Falloff (SetTraumaFalloff and GetTraumaFalloff)**: | ||
The traumaFalloff_ parameter determines how quickly the trauma decreases. | ||
It specifies how many units of trauma are lost per second. | ||
|
||
- **Shift Range (SetShiftRange and GetShiftRange)**: | ||
The shiftRange_ defines the maximum displacement range for the camera position. | ||
You can set it to control how far the camera moves during the shake. | ||
|
||
- **Rotation Range (SetRotationRange and GetRotationRange)**: | ||
The rotationRange_ specifies the maximum rotation (pitch, yaw, roll) allowed during the shake. | ||
Adjust this to create rotational jitter along with the positional shake. | ||
|
||
Finally, the Update method is where the actual shaking logic happens. It modifies the node’s position and rotation based on Perlin noise generated by the perlinNoise_ generator. | ||
|
||
Remember to adjust the parameters according to your desired visual effect. The ShakeComponent can add dynamism and excitement to your game! | ||
|
||
Learn more about Perlin noise for camera shake at https://www.gdcvault.com/play/1033548/Math-for-Game-Programmers-Juicing |