Working on fixing dorm bugs and some uni

This commit is contained in:
Vladislav Khorev committed 2026-06-16 14:05:18 +03:00
1 parent 939136c705
commit c891161d69
16 files changed
+200 -230

No files matched your search

+7 -2
View File
@@ -240,7 +240,7 @@ void Character::update(int64_t deltaMs) {
lookTarget = attackTarget->position;
}
targetFacingAngle = facingAngle;
//targetFacingAngle = facingAngle;
if (currentState == AnimationState::WALK || currentState == AnimationState::STAND)
{
@@ -294,7 +294,7 @@ void Character::update(int64_t deltaMs) {
}
}
else {
targetFacingAngle = facingAngle;
//targetFacingAngle = facingAngle;
}
}
}
@@ -355,6 +355,9 @@ void Character::update(int64_t deltaMs) {
while (angleDiff > static_cast<float>(M_PI)) angleDiff -= 2.f * static_cast<float>(M_PI);
while (angleDiff < -static_cast<float>(M_PI)) angleDiff += 2.f * static_cast<float>(M_PI);
float rotStep = rotationSpeed * static_cast<float>(deltaMs) / 1000.f;
//std::cout << this->npcName << " targetFacingAngle: " << targetFacingAngle << " radians, " << (targetFacingAngle * 180.f / static_cast<float>(M_PI)) << " degrees\n";
//std::cout << this->npcName << " facingAngle: " << facingAngle << " radians, " << (facingAngle * 180.f / static_cast<float>(M_PI)) << " degrees\n";
if (std::fabs(angleDiff) <= rotStep) {
facingAngle = targetFacingAngle;
// One-shot face-target: once aligned, stop tracking. Otherwise the NPC
@@ -362,6 +365,8 @@ void Character::update(int64_t deltaMs) {
// started, even as the player moved away.
faceTarget = nullptr;
} else {
//std::cout << this->npcName << " facingAngle difference: " << angleDiff << " radians, " << (angleDiff * 180.f / static_cast<float>(M_PI)) << " degrees\n";
facingAngle += (angleDiff > 0.f ? rotStep : -rotStep);
}