Camera Shake System - #49
Merged
Merged
Conversation
Has all the desired ease types!
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces a camera shake feature into the engine’s camera pipeline, including configurable easing and parameters, and triggers a hit-shake when the player takes damage.
Changes:
- Added camera shake state and parameters to
Components::Camera(ease types + shake runtime fields). - Implemented shake evaluation + per-frame shake updates in
Systems::CameraSystem, applying translation and Z-rotation in the view matrix. - Triggered a camera shake on player damage in
HealthComponent.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| Source/Systems/Camera/CameraSystem.h | Exposes new camera shake-related methods on CameraSystem. |
| Source/Systems/Camera/CameraSystem.cpp | Implements shake logic and applies shake offsets/rotation in GetViewMatrix() and update loop. |
| Source/Components/HealthComponent.cpp | Triggers a camera shake when the player takes damage. |
| Source/Components/Camera.h | Adds shake params/ease enum and per-camera shake runtime state. |
| Source/Components/Camera.cpp | Copies newly added shake fields in Camera copy constructor. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+97
to
+107
| auto *cameraSys = RassEngine::Systems::ICameraSystem::Get(); | ||
| if(cameraSys) { | ||
| RassEngine::Components::CameraShakeParams hitShake; | ||
| hitShake.shakeDuration = 0.35f; | ||
| hitShake.vibrationSpeed = 35.0f; | ||
| hitShake.maxTranslation = glm::vec3(0.4f, 0.4f, 0.0f); | ||
| hitShake.maxZRotation = 4.0f; | ||
| hitShake.easeType = RassEngine::Components::CameraShakeEase::EaseOut; | ||
|
|
||
| static_cast<RassEngine::Systems::CameraSystem *>(cameraSys)->ShakeCamera(hitShake); | ||
| } |
Comment on lines
+208
to
+210
| camera->shakeOffset.x = shakeX * camera->shakeParams.maxTranslation.x * envelope; | ||
| camera->shakeOffset.y = shakeY * camera->shakeParams.maxTranslation.y * envelope; | ||
| camera->shakeOffset.z = shakeZ * camera->shakeParams.maxTranslation.y * envelope; |
| float shakeDuration = 0.5f; | ||
| float vibrationSpeed = 20.0f; | ||
| glm::vec3 maxTranslation{0.5f, 0.5f, 0.0f}; | ||
| float maxZRotation = 5.0f; //this is the maximum for a Dutch Angle |
huboyuan2
approved these changes
Jun 21, 2026
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Has all the desired ease types!