mirror of
https://gitea.wildfiregames.com/0ad/0ad
synced 2026-06-16 13:23:56 -07:00
Fixes units not rotating correctly during e.g. attacks, patch by sbte, fixes #1906
This was SVN commit r13489.
This commit is contained in:
parent
95b51188fa
commit
a7bc7ab50c
1 changed files with 11 additions and 3 deletions
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2012 Wildfire Games.
|
||||
/* Copyright (C) 2013 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
|
|
@ -73,7 +73,7 @@ public:
|
|||
bool m_RelativeToGround; // whether m_YOffset is relative to terrain/water plane, or an absolute height
|
||||
|
||||
entity_angle_t m_RotX, m_RotY, m_RotZ;
|
||||
float m_InterpolatedRotY; // not serialized
|
||||
float m_InterpolatedRotY, m_PrevInterpolatedRotY; // not serialized
|
||||
|
||||
static std::string GetSchema()
|
||||
{
|
||||
|
|
@ -122,7 +122,7 @@ public:
|
|||
m_RotYSpeed = paramNode.GetChild("TurnRate").ToFixed().ToFloat();
|
||||
|
||||
m_RotX = m_RotY = m_RotZ = entity_angle_t::FromInt(0);
|
||||
m_InterpolatedRotY = 0;
|
||||
m_InterpolatedRotY = m_PrevInterpolatedRotY = 0;
|
||||
}
|
||||
|
||||
virtual void Deinit()
|
||||
|
|
@ -328,6 +328,7 @@ public:
|
|||
{
|
||||
m_RotY = y;
|
||||
m_InterpolatedRotY = m_RotY.ToFloat();
|
||||
m_PrevInterpolatedRotY = m_InterpolatedRotY;
|
||||
|
||||
AdvertisePositionChanges();
|
||||
}
|
||||
|
|
@ -442,6 +443,13 @@ public:
|
|||
m_LastX = m_X;
|
||||
m_LastZ = m_Z;
|
||||
|
||||
// HACK: Rotation interpolation can take a long time, so advertise position
|
||||
// changes again to force recomputation of the transformation matrix
|
||||
// if the rotation was not done yet.
|
||||
if (fabs(m_PrevInterpolatedRotY - m_InterpolatedRotY) > 0.001f)
|
||||
AdvertisePositionChanges();
|
||||
m_PrevInterpolatedRotY = m_InterpolatedRotY;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue