mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-10-11 01:48:07 +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:
@@ -1,9 +1,7 @@
|
||||
#include "VehiclePhysicsComponent.h"
|
||||
#include "EntityManager.h"
|
||||
|
||||
VehiclePhysicsComponent::VehiclePhysicsComponent(Entity* parent) : Component(parent) {
|
||||
m_Position = NiPoint3::ZERO;
|
||||
m_Rotation = NiQuaternion::IDENTITY;
|
||||
VehiclePhysicsComponent::VehiclePhysicsComponent(Entity* parent) : PhysicsComponent(parent) {
|
||||
m_Velocity = NiPoint3::ZERO;
|
||||
m_AngularVelocity = NiPoint3::ZERO;
|
||||
m_IsOnGround = true;
|
||||
@@ -14,22 +12,6 @@ VehiclePhysicsComponent::VehiclePhysicsComponent(Entity* parent) : Component(par
|
||||
m_EndBehavior = GeneralUtils::GenerateRandomNumber<uint32_t>(0, 7);
|
||||
}
|
||||
|
||||
VehiclePhysicsComponent::~VehiclePhysicsComponent() {
|
||||
|
||||
}
|
||||
|
||||
void VehiclePhysicsComponent::SetPosition(const NiPoint3& pos) {
|
||||
if (pos == m_Position) return;
|
||||
m_DirtyPosition = true;
|
||||
m_Position = pos;
|
||||
}
|
||||
|
||||
void VehiclePhysicsComponent::SetRotation(const NiQuaternion& rot) {
|
||||
if (rot == m_Rotation) return;
|
||||
m_DirtyPosition = true;
|
||||
m_Rotation = rot;
|
||||
}
|
||||
|
||||
void VehiclePhysicsComponent::SetVelocity(const NiPoint3& vel) {
|
||||
if (vel == m_Velocity) return;
|
||||
m_DirtyPosition = true;
|
||||
@@ -60,10 +42,6 @@ void VehiclePhysicsComponent::SetRemoteInputInfo(const RemoteInputInfo& remoteIn
|
||||
m_DirtyRemoteInput = true;
|
||||
}
|
||||
|
||||
void VehiclePhysicsComponent::SetDirtyPosition(bool val) {
|
||||
m_DirtyPosition = val;
|
||||
}
|
||||
|
||||
void VehiclePhysicsComponent::SetDirtyVelocity(bool val) {
|
||||
m_DirtyVelocity = val;
|
||||
}
|
||||
|
Reference in New Issue
Block a user