Skip to content

Camera Shake System - #49

Merged
huboyuan2 merged 1 commit into
mainfrom
origin/steven/Camera-Shake-System
Jul 11, 2026
Merged

Camera Shake System#49
huboyuan2 merged 1 commit into
mainfrom
origin/steven/Camera-Shake-System

Conversation

@Stevenyacoub

Copy link
Copy Markdown
Collaborator

Has all the desired ease types!

Has all the desired ease types!

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
huboyuan2 merged commit 4f02b06 into main Jul 11, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants