refactor(camera): 移除相机跟随的线性插值逻辑
直接使用目标位置作为焦点,简化相机跟随实现
This commit is contained in:
@@ -46,7 +46,6 @@ private:
|
|||||||
bool initialized_ = false;
|
bool initialized_ = false;
|
||||||
|
|
||||||
float zoom_ = 1.2f;
|
float zoom_ = 1.2f;
|
||||||
float followLerpSpeed_ = 8.0f;
|
|
||||||
float debugMoveSpeed_ = 800.0f;
|
float debugMoveSpeed_ = 800.0f;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -89,9 +89,7 @@ void GameCameraController::Update(float deltaTime) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (target_) {
|
if (target_) {
|
||||||
Vec2 targetFocus = target_->GetPosition();
|
focus_ = target_->GetPosition();
|
||||||
float t = std::clamp(deltaTime * followLerpSpeed_, 0.0f, 1.0f);
|
|
||||||
focus_ = focus_ + (targetFocus - focus_) * t;
|
|
||||||
} else if (debugEnabled_) {
|
} else if (debugEnabled_) {
|
||||||
updateDebugInput(deltaTime);
|
updateDebugInput(deltaTime);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user