1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-10 15:39:02 +00:00
OpenMW/apps/openmw/mwmechanics/movement.hpp
psi29a f90a049702 Merge branch 'movement_refactoring' into 'master'
Refactoring related to "smooth movement"

See merge request OpenMW/openmw!285

(cherry picked from commit 6eaf0a389d5aed3b74ab1a7cf89574612f964bdf)

e847b4c8 Split getSpeed() to getMaxSpeed() and getCurrentSpeed()
a96c46bc Refactor calculation of movement.mSpeedFactor
03ee9090 Use getMaxSpeed instead of getCurrentSpeed where it makes sense.
a178af5c Create helper functions `normalizeAngle` and `rotateVec2f`
2020-08-27 11:54:30 +00:00

38 lines
1.1 KiB
C++

#ifndef GAME_MWMECHANICS_MOVEMENT_H
#define GAME_MWMECHANICS_MOVEMENT_H
#include <osg/Vec3f>
namespace MWMechanics
{
/// Desired movement for an actor
struct Movement
{
// Desired movement. Direction is relative to the current orientation.
// Length of the vector controls desired speed. 0 - stay, 0.5 - half-speed, 1.0 - max speed.
float mPosition[3];
// Desired rotation delta (euler angles).
float mRotation[3];
// Controlled by CharacterController, should not be changed from other places.
// These fields can not be private fields in CharacterController, because Actor::getCurrentSpeed uses it.
float mSpeedFactor;
bool mIsStrafing;
Movement()
{
mPosition[0] = mPosition[1] = mPosition[2] = 0.0f;
mRotation[0] = mRotation[1] = mRotation[2] = 0.0f;
mSpeedFactor = 1.f;
mIsStrafing = false;
}
osg::Vec3f asVec3()
{
return osg::Vec3f(mPosition[0], mPosition[1], mPosition[2]);
}
};
}
#endif