1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-09-15 15:02:34 +02:00

Only face movement direction when not strafing

This commit is contained in:
Daniel Evans 2016-12-01 23:48:01 +00:00
parent 920d3f86fe
commit b9740b3b8a
2 changed files with 10 additions and 2 deletions

View File

@ -319,8 +319,11 @@ void CharacterObject::updateCharacter(float dt) {
glm::vec3 walkDir = updateMovementAnimation(dt);
if (canTurn()) {
// Rotation is based on look angles and movement
float yaw = m_look.x + std::atan2(movement.z, movement.x);
float yaw = m_look.x;
// When strafing we need to detach look direction from movement
if (!isStrafing()) {
yaw += std::atan2(movement.z, movement.x);
}
rotation = glm::quat(glm::vec3(0.f, 0.f, yaw));
}

View File

@ -196,6 +196,11 @@ public:
return running;
}
bool isStrafing() const {
/// @todo implement strafing
return false;
}
/**
* Resets the Actor to the nearest AI Graph node
* (taking into account the current vehicle)