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:
parent
920d3f86fe
commit
b9740b3b8a
@ -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));
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user