mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-15 20:19:56 +00:00
f684c90932
To avoid moving in circles for actors with high speed.
34 lines
884 B
C++
34 lines
884 B
C++
#ifndef OPENMW_MECHANICS_STEERING_H
|
|
#define OPENMW_MECHANICS_STEERING_H
|
|
|
|
#include <osg/Math>
|
|
|
|
#include <algorithm>
|
|
|
|
namespace MWWorld
|
|
{
|
|
class Ptr;
|
|
}
|
|
|
|
namespace MWMechanics
|
|
{
|
|
|
|
// Max rotating speed, radian/sec
|
|
inline float getAngularVelocity(const float actorSpeed)
|
|
{
|
|
const float baseAngluarVelocity = 10;
|
|
const float baseSpeed = 200;
|
|
return baseAngluarVelocity * std::max(actorSpeed / baseSpeed, 1.0f);
|
|
}
|
|
|
|
/// configure rotation settings for an actor to reach this target angle (eventually)
|
|
/// @return have we reached the target angle?
|
|
bool zTurn(const MWWorld::Ptr& actor, float targetAngleRadians,
|
|
float epsilonRadians = osg::DegreesToRadians(0.5));
|
|
|
|
bool smoothTurn(const MWWorld::Ptr& actor, float targetAngleRadians, int axis,
|
|
float epsilonRadians = osg::DegreesToRadians(0.5));
|
|
|
|
}
|
|
|
|
#endif
|