mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-12-24 14:33:34 +00:00
fixes
This commit is contained in:
parent
67cd990d98
commit
daf5a7ffa9
@ -117,7 +117,10 @@ void ControllablePhysicsComponent::Serialize(RakNet::BitStream* outBitStream, bo
|
||||
}
|
||||
if (!bIsInitialUpdate) m_DirtyBubble = false;
|
||||
}
|
||||
|
||||
|
||||
bool isVelocityZero = m_Velocity != NiPoint3::ZERO;
|
||||
bool isAngularVelocityZero = m_AngularVelocity != NiPoint3::ZERO;
|
||||
bool shouldWriteFrameStats = m_DirtyPosition || bIsInitialUpdate || isVelocityZero || isAngularVelocityZero;
|
||||
outBitStream->Write(m_DirtyPosition || bIsInitialUpdate);
|
||||
if (m_DirtyPosition || bIsInitialUpdate) {
|
||||
outBitStream->Write(m_Position.x);
|
||||
@ -132,7 +135,6 @@ void ControllablePhysicsComponent::Serialize(RakNet::BitStream* outBitStream, bo
|
||||
outBitStream->Write(m_IsOnGround);
|
||||
outBitStream->Write(m_IsOnRail);
|
||||
|
||||
bool isVelocityZero = m_Velocity != NiPoint3::ZERO;
|
||||
outBitStream->Write(isVelocityZero);
|
||||
if (isVelocityZero) {
|
||||
outBitStream->Write(m_Velocity.x);
|
||||
@ -140,7 +142,6 @@ void ControllablePhysicsComponent::Serialize(RakNet::BitStream* outBitStream, bo
|
||||
outBitStream->Write(m_Velocity.z);
|
||||
}
|
||||
|
||||
bool isAngularVelocityZero = m_AngularVelocity != NiPoint3::ZERO;
|
||||
outBitStream->Write(isAngularVelocityZero);
|
||||
if (isAngularVelocityZero) {
|
||||
outBitStream->Write(m_AngularVelocity.x);
|
||||
@ -202,9 +203,7 @@ void ControllablePhysicsComponent::SetPosition(const NiPoint3& pos) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_Position.x = pos.x;
|
||||
m_Position.y = pos.y;
|
||||
m_Position.z = pos.z;
|
||||
m_Position = pos;
|
||||
m_DirtyPosition = true;
|
||||
|
||||
if (m_dpEntity) m_dpEntity->SetPosition(pos);
|
||||
|
@ -143,11 +143,11 @@ void MovementAIComponent::Update(const float deltaTime) {
|
||||
return;
|
||||
}
|
||||
|
||||
// if (m_CurrentSpeed < m_MaxSpeed) {
|
||||
// m_CurrentSpeed += m_Acceleration;
|
||||
// }
|
||||
|
||||
if (m_CurrentSpeed < m_MaxSpeed) {
|
||||
m_CurrentSpeed += m_Acceleration;
|
||||
}
|
||||
|
||||
if (m_CurrentSpeed > m_MaxSpeed) {
|
||||
m_CurrentSpeed = m_MaxSpeed;
|
||||
}
|
||||
|
||||
@ -221,10 +221,15 @@ NiPoint3 MovementAIComponent::GetCurrentWaypoint() const {
|
||||
NiPoint3 MovementAIComponent::ApproximateLocation() const {
|
||||
auto source = m_Parent->GetPosition();
|
||||
if (AtFinalWaypoint()) return source;
|
||||
NiPoint3 approximation = source;
|
||||
|
||||
// Only have physics sim for controllable physics
|
||||
if (!m_Parent->HasComponent(ControllablePhysicsComponent::ComponentType)) {
|
||||
auto destination = GetNextWaypoint();
|
||||
auto percentageToWaypoint = m_TimeToTravel > 0 ? m_TimeTravelled / m_TimeToTravel : 0;
|
||||
approximation = source + ((destination - source) * percentageToWaypoint);
|
||||
}
|
||||
|
||||
auto destination = GetNextWaypoint();
|
||||
auto percentageToWaypoint = m_TimeToTravel > 0 ? m_TimeTravelled / m_TimeToTravel : 0;
|
||||
auto approximation = source + ((destination - source) * percentageToWaypoint);
|
||||
if (dpWorld::Instance().IsLoaded()) {
|
||||
approximation.y = dpWorld::Instance().GetNavMesh()->GetHeightAtPoint(approximation);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user