Limits view angle during weapon recoil computation

This commit is contained in:
yvt 2013-08-28 01:03:34 +09:00
parent 9a096f3b75
commit e9f7bbc870

View File

@ -522,7 +522,9 @@ namespace spades {
// in AoS 0.75's way
Vector3 o = orientation;
Vector3 rec = weapon->GetRecoil();
o += GetUp() * rec.y;
float upLimit = Vector3::Dot(GetFront2D(), o);
upLimit -= 0.03f;
o += GetUp() * std::min(rec.y, std::max(0.f, upLimit));
o += GetRight() * rec.x * sinf(world->GetTime() * 2.f);
o = o.Normalize();
SetOrientation(o);