Adding rewindable mechanisms to support interpolation
Signed-off-by: puvvadar <puvvadar@amazon.com>
This commit is contained in:
@@ -54,6 +54,11 @@ namespace Multiplayer
|
||||
return m_hostTimeMs;
|
||||
}
|
||||
|
||||
float NetworkTime::GetHostBlendFactor() const
|
||||
{
|
||||
return m_hostBlendFactor;
|
||||
}
|
||||
|
||||
AzNetworking::ConnectionId NetworkTime::GetRewindingConnectionId() const
|
||||
{
|
||||
return m_rewindingConnectionId;
|
||||
@@ -71,6 +76,11 @@ namespace Multiplayer
|
||||
m_rewindingConnectionId = rewindConnectionId;
|
||||
}
|
||||
|
||||
void NetworkTime::AlterBlendFactor(float blendFactor)
|
||||
{
|
||||
m_hostBlendFactor = blendFactor;
|
||||
}
|
||||
|
||||
void NetworkTime::SyncEntitiesToRewindState(const AZ::Aabb& rewindVolume)
|
||||
{
|
||||
// Since the vis system doesn't support rewound queries, first query with an expanded volume to catch any fast moving entities
|
||||
@@ -94,6 +104,7 @@ namespace Multiplayer
|
||||
|
||||
if (networkTransform != nullptr)
|
||||
{
|
||||
// We're not presently factoring in interpolated position here
|
||||
const AZ::Vector3 rewindCenter = networkTransform->GetTranslation(); // Get the rewound position
|
||||
const AZ::Vector3 rewindOffset = rewindCenter - currentCenter; // Compute offset between rewound and current positions
|
||||
const AZ::Aabb rewoundAabb = currentBounds.GetTranslated(rewindOffset); // Apply offset to the entity aabb
|
||||
|
||||
@@ -29,9 +29,11 @@ namespace Multiplayer
|
||||
HostFrameId GetUnalteredHostFrameId() const override;
|
||||
void IncrementHostFrameId() override;
|
||||
AZ::TimeMs GetHostTimeMs() const override;
|
||||
float GetHostBlendFactor() const override;
|
||||
AzNetworking::ConnectionId GetRewindingConnectionId() const override;
|
||||
HostFrameId GetHostFrameIdForRewindingConnection(AzNetworking::ConnectionId rewindConnectionId) const override;
|
||||
void AlterTime(HostFrameId frameId, AZ::TimeMs timeMs, AzNetworking::ConnectionId rewindConnectionId) override;
|
||||
void AlterBlendFactor(float blendFactor) override;
|
||||
void SyncEntitiesToRewindState(const AZ::Aabb& rewindVolume) override;
|
||||
void ClearRewoundEntities() override;
|
||||
//! @}
|
||||
@@ -43,6 +45,7 @@ namespace Multiplayer
|
||||
HostFrameId m_hostFrameId = HostFrameId{ 0 };
|
||||
HostFrameId m_unalteredFrameId = HostFrameId{ 0 };
|
||||
AZ::TimeMs m_hostTimeMs = AZ::TimeMs{ 0 };
|
||||
float m_hostBlendFactor = DefaultBlendFactor;
|
||||
AzNetworking::ConnectionId m_rewindingConnectionId = AzNetworking::InvalidConnectionId;
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user