Hi everyone,
I read the fix your timestamp blog, I loved it, and I agree with it, my only issue is that if I want to use it, I will have to code something like this
template<typename T>
struct FixUpdT
{
public:
FixUpdT()
: beg{}
, end{}
, cur{}
{
}
void Init()
{
cur = beg = end;
}
void Sim( float alpha )
{
cur = Math::Lerp( beg, end, alpha );
}
T beg;
T end;
T cur;
};
class Entity
{
public:
void Update( float dt )
{
m_position.Init();
}
void Render( float dt, float alpha )
{
m_position.Sim( alpha );
}
Vector3& GetPosition() const { return m_position.end; }
Vector3& GetSimPosition() const { return m_position.cur; }
FixUpdT<Vector3> m_position;
}
All the entities would have to call Update and Init function (to fix this, I could have a dirty flag if position has change), also I would have to think when to use GetPosition (in update function prob) and when GetSimPosition (in render prob)
But I'm not 100% sure if this is the best way, anyone else have a comment about this, maybe I'm doing something wrong.
Thanks!