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:
@@ -2,7 +2,7 @@
|
||||
|
||||
#include "BitStream.h"
|
||||
#include "Entity.h"
|
||||
#include "Component.h"
|
||||
#include "PhysicsComponent.h"
|
||||
#include "eReplicaComponentType.h"
|
||||
|
||||
struct RemoteInputInfo {
|
||||
@@ -26,41 +26,16 @@ struct RemoteInputInfo {
|
||||
/**
|
||||
* Physics component for vehicles.
|
||||
*/
|
||||
class VehiclePhysicsComponent : public Component {
|
||||
class VehiclePhysicsComponent : public PhysicsComponent {
|
||||
public:
|
||||
static const eReplicaComponentType ComponentType = eReplicaComponentType::VEHICLE_PHYSICS;
|
||||
|
||||
VehiclePhysicsComponent(Entity* parentEntity);
|
||||
~VehiclePhysicsComponent() override;
|
||||
|
||||
void Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate) override;
|
||||
|
||||
void Update(float deltaTime) override;
|
||||
|
||||
/**
|
||||
* Sets the position
|
||||
* @param pos the new position
|
||||
*/
|
||||
void SetPosition(const NiPoint3& pos);
|
||||
|
||||
/**
|
||||
* Gets the position
|
||||
* @return the position
|
||||
*/
|
||||
const NiPoint3& GetPosition() const { return m_Position; }
|
||||
|
||||
/**
|
||||
* Sets the rotation
|
||||
* @param rot the new rotation
|
||||
*/
|
||||
void SetRotation(const NiQuaternion& rot);
|
||||
|
||||
/**
|
||||
* Gets the rotation
|
||||
* @return the rotation
|
||||
*/
|
||||
const NiQuaternion& GetRotation() const { return m_Rotation; }
|
||||
|
||||
/**
|
||||
* Sets the velocity
|
||||
* @param vel the new velocity
|
||||
@@ -115,10 +90,6 @@ public:
|
||||
void SetRemoteInputInfo(const RemoteInputInfo&);
|
||||
|
||||
private:
|
||||
bool m_DirtyPosition;
|
||||
NiPoint3 m_Position;
|
||||
NiQuaternion m_Rotation;
|
||||
|
||||
bool m_DirtyVelocity;
|
||||
NiPoint3 m_Velocity;
|
||||
|
||||
|
Reference in New Issue
Block a user