ModelBehaviorComponent pass

This commit is contained in:
EmosewaMC 2023-07-05 20:37:16 -07:00
parent 001f6a75eb
commit 5301346ed5
2 changed files with 12 additions and 4 deletions

View File

@ -3,7 +3,7 @@
#include "ePhysicsBehaviorType.h"
ModelBehaviorComponent::ModelBehaviorComponent(Entity* parent) : Component(parent) {
m_DirtyModelInfo = false;
m_DirtyModelInfo = true;
m_IsPickable = false;
m_PhysicsType = ePhysicsBehaviorType::STANDARD;
m_OriginalPosition = m_ParentEntity->GetDefaultPosition();
@ -17,7 +17,7 @@ void ModelBehaviorComponent::Serialize(RakNet::BitStream* outBitStream, bool bIs
outBitStream->Write(m_PhysicsType);
outBitStream->Write(m_OriginalPosition);
outBitStream->Write(m_OriginalRotation);
m_DirtyModelInfo = false;
if (!bIsInitialUpdate) m_DirtyModelInfo = false;
}
}

View File

@ -30,7 +30,11 @@ public:
* Sets the original position of the model
* @param pos the original position to set
*/
void SetPosition(const NiPoint3& pos) { m_OriginalPosition = pos; m_DirtyModelInfo = true; }
void SetPosition(const NiPoint3& pos) {
if (m_OriginalPosition == pos) return;
m_OriginalPosition = pos;
m_DirtyModelInfo = true;
}
/**
* Returns the original rotation of the model
@ -42,7 +46,11 @@ public:
* Sets the original rotation of the model
* @param rot the original rotation to set
*/
void SetRotation(const NiQuaternion& rot) { m_OriginalRotation = rot; m_DirtyModelInfo = true; }
void SetRotation(const NiQuaternion& rot) {
if (m_OriginalRotation == rot) return;
m_OriginalRotation = rot;
m_DirtyModelInfo = true;
}
private: