A Unity script designed to add shake effects to your camera, enhancing the player's experience by creating dynamic camera movements. It is ideal for simulating impacts, explosions, or other dramatic moments in your game.
- Shake Effects: Adds camera shake effects when triggered, adding intensity and immersion to the gameplay.
- Customizable Parameters: Easily control the shake intensity, duration, and frequency to match the desired effect.
- Simple Integration: Just import the
CameraShakeController
package, attach the script to your camera, and you're ready to create dynamic shake effects with minimal setup. - Triggerable Events: Control the shake through code, making it easy to activate during specific events like collisions, explosions, or key actions in the game.
- Download the
CameraShakeController.unitypackage
file from this repository. - Open your Unity project and go to Assets > Import Package > Custom Package.
- Select the
CameraShakeController.unitypackage
file and click Import. - After importing, attach the
CameraShakeController
script to your main camera in the scene.- Important: Ensure that the camera's position is not controlled by another script (such as a camera follow script) to prevent the shake effect from being canceled or overridden.
- Import the asset by following the installation steps above.
- Attach the
CameraShakeController
script to your camera by selecting the camera in the scene and clicking Add Component. - Adjust the script parameters in the Inspector to customize the shake effect (e.g., intensity, duration, frequency).
- To trigger the camera shake:
- Call the
TriggerShake()
method from your other scripts when you want the shake effect to occur. - Example:
CameraShakeController.TriggerShake(0.3f, 0.5f); // Shake with duration 0.3 seconds and magnitude 0.5.
- Call the
This project is licensed under the MIT License - see the LICENSE file for details.