mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-08-09 20:24:16 +00:00
chore: Physics Component abstraction and addition of tests (#1159)
* Make serialize actually virtual yep * Abstract to PhysicsComponent Move shared functionality of all physics related classes to a base class. Tested that there were no failed to unserialize errors when in main gameplay in Gnarled Forest or in a race. Tested that 2 players were able to see each other in the above scenarios just fine as well. * Update PhantomPhysicsComponent.cpp * Add SimplePhysicsTest * Add construction test * Update SimplePhysicsComponentTests.cpp * remove flags and fix override * Update VendorComponent.h
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
#include "RakNetTypes.h"
|
||||
#include "NiPoint3.h"
|
||||
#include "NiQuaternion.h"
|
||||
#include "Component.h"
|
||||
#include "PhysicsComponent.h"
|
||||
#include "eReplicaComponentType.h"
|
||||
|
||||
class Entity;
|
||||
@@ -26,7 +26,7 @@ enum class eClimbableType : int32_t {
|
||||
/**
|
||||
* Component that serializes locations of entities to the client
|
||||
*/
|
||||
class SimplePhysicsComponent : public Component {
|
||||
class SimplePhysicsComponent : public PhysicsComponent {
|
||||
public:
|
||||
static const eReplicaComponentType ComponentType = eReplicaComponentType::SIMPLE_PHYSICS;
|
||||
|
||||
@@ -35,30 +35,6 @@ public:
|
||||
|
||||
void Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate) override;
|
||||
|
||||
/**
|
||||
* Returns the position of this entity
|
||||
* @return the position of this entity
|
||||
*/
|
||||
NiPoint3& GetPosition() { return m_Position; }
|
||||
|
||||
/**
|
||||
* Sets the position of this entity
|
||||
* @param pos the position to set
|
||||
*/
|
||||
void SetPosition(const NiPoint3& pos) { m_Position = pos; m_IsDirty = true; }
|
||||
|
||||
/**
|
||||
* Returns the rotation of this entity
|
||||
* @return the rotation of this entity
|
||||
*/
|
||||
NiQuaternion& GetRotation() { return m_Rotation; }
|
||||
|
||||
/**
|
||||
* Sets the rotation of this entity
|
||||
* @param rot
|
||||
*/
|
||||
void SetRotation(const NiQuaternion& rot) { m_Rotation = rot; m_IsDirty = true; }
|
||||
|
||||
/**
|
||||
* Returns the velocity of this entity
|
||||
* @return the velocity of this entity
|
||||
@@ -108,17 +84,6 @@ public:
|
||||
void SetClimbableType(const eClimbableType& value) { m_ClimbableType = value; }
|
||||
|
||||
private:
|
||||
|
||||
/**
|
||||
* The current position of the entity
|
||||
*/
|
||||
NiPoint3 m_Position = NiPoint3::ZERO;
|
||||
|
||||
/**
|
||||
* The current rotation of the entity
|
||||
*/
|
||||
NiQuaternion m_Rotation = NiQuaternion::IDENTITY;
|
||||
|
||||
/**
|
||||
* The current velocity of the entity
|
||||
*/
|
||||
@@ -134,11 +99,6 @@ private:
|
||||
*/
|
||||
bool m_DirtyVelocity = true;
|
||||
|
||||
/**
|
||||
* Whether or not the position has changed
|
||||
*/
|
||||
bool m_IsDirty = true;
|
||||
|
||||
/**
|
||||
* The current physics motion state
|
||||
*/
|
||||
|
Reference in New Issue
Block a user