|
|
|
@ -1954,20 +1954,15 @@ void CharacterController::update(float duration, bool animationOnly)
|
|
|
|
|
|
|
|
|
|
osg::Vec3f rot = cls.getRotationVector(mPtr);
|
|
|
|
|
osg::Vec3f vec(movementSettings.asVec3());
|
|
|
|
|
|
|
|
|
|
if (isPlayer)
|
|
|
|
|
{
|
|
|
|
|
// TODO: Move this code to mwinput.
|
|
|
|
|
// Joystick analogue movement.
|
|
|
|
|
movementSettings.mSpeedFactor = std::max(std::abs(vec.x()), std::abs(vec.y()));
|
|
|
|
|
|
|
|
|
|
// Due to the half way split between walking/running, we multiply speed by 2 while walking, unless a keyboard was used.
|
|
|
|
|
if(!isrunning && !sneak && !flying && movementSettings.mSpeedFactor <= 0.5f)
|
|
|
|
|
movementSettings.mSpeedFactor *= 2.f;
|
|
|
|
|
} else
|
|
|
|
|
movementSettings.mSpeedFactor = std::min(vec.length(), 1.f);
|
|
|
|
|
movementSettings.mSpeedFactor = std::min(vec.length(), 1.f);
|
|
|
|
|
vec.normalize();
|
|
|
|
|
|
|
|
|
|
// TODO: Move this check to mwinput.
|
|
|
|
|
// Joystick analogue movement.
|
|
|
|
|
// Due to the half way split between walking/running, we multiply speed by 2 while walking, unless a keyboard was used.
|
|
|
|
|
if (isPlayer && !isrunning && !sneak && !flying && movementSettings.mSpeedFactor <= 0.5f)
|
|
|
|
|
movementSettings.mSpeedFactor *= 2.f;
|
|
|
|
|
|
|
|
|
|
float effectiveRotation = rot.z();
|
|
|
|
|
bool canMove = cls.getMaxSpeed(mPtr) > 0;
|
|
|
|
|
static const bool turnToMovementDirection = Settings::Manager::getBool("turn to movement direction", "Game");
|
|
|
|
|