2021-12-05 17:54:36 +00:00
|
|
|
/*
|
|
|
|
* Darkflame Universe
|
|
|
|
* Copyright 2019
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef RIGIDBODYPHANTOMPHYSICS_H
|
|
|
|
#define RIGIDBODYPHANTOMPHYSICS_H
|
|
|
|
|
|
|
|
#include "BitStream.h"
|
|
|
|
#include "dCommonVars.h"
|
|
|
|
#include "NiPoint3.h"
|
|
|
|
#include "NiQuaternion.h"
|
|
|
|
#include "Component.h"
|
2023-03-04 07:16:37 +00:00
|
|
|
#include "eReplicaComponentType.h"
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
/**
|
|
|
|
* Component that handles rigid bodies that can be interacted with, mostly client-side rendered. An example is the
|
|
|
|
* bananas that fall from trees in GF.
|
|
|
|
*/
|
2021-12-05 17:54:36 +00:00
|
|
|
class RigidbodyPhantomPhysicsComponent : public Component {
|
|
|
|
public:
|
2023-03-04 07:16:37 +00:00
|
|
|
static const eReplicaComponentType ComponentType = eReplicaComponentType::PHANTOM_PHYSICS;
|
2022-07-28 13:39:57 +00:00
|
|
|
|
|
|
|
RigidbodyPhantomPhysicsComponent(Entity* parent);
|
|
|
|
~RigidbodyPhantomPhysicsComponent() override;
|
|
|
|
|
|
|
|
void Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags);
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
/**
|
|
|
|
* Returns the position of this entity
|
|
|
|
* @return the position of this entity
|
|
|
|
*/
|
|
|
|
NiPoint3& GetPosition() { return m_Position; }
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
/**
|
|
|
|
* Sets the position of this entity
|
|
|
|
* @param pos the position to set
|
|
|
|
*/
|
|
|
|
void SetPosition(const NiPoint3& pos) { m_Position = pos; m_IsDirty = true; }
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
/**
|
|
|
|
* Returns the rotation of this entity
|
|
|
|
* @return the rotation of this entity
|
|
|
|
*/
|
|
|
|
NiQuaternion& GetRotation() { return m_Rotation; }
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
/**
|
|
|
|
* Sets the rotation for this entity
|
|
|
|
* @param rot the rotation to tset
|
|
|
|
*/
|
|
|
|
void SetRotation(const NiQuaternion& rot) { m_Rotation = rot; m_IsDirty = true; }
|
2021-12-05 17:54:36 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
/**
|
|
|
|
* The position of this entity
|
|
|
|
*/
|
|
|
|
NiPoint3 m_Position;
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
/**
|
|
|
|
* The rotation of this entity
|
|
|
|
*/
|
|
|
|
NiQuaternion m_Rotation;
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
/**
|
|
|
|
* Whether or not the component should be serialized
|
|
|
|
*/
|
|
|
|
bool m_IsDirty;
|
2021-12-05 17:54:36 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // RIGIDBODYPHANTOMPHYSICS_H
|