2024-02-25 14:46:47 +00:00
|
|
|
#pragma once
|
2023-06-20 04:33:09 +00:00
|
|
|
|
|
|
|
#include "StarObject.hpp"
|
|
|
|
#include "StarPhysicsEntity.hpp"
|
|
|
|
|
|
|
|
namespace Star {
|
|
|
|
|
|
|
|
class PhysicsObject : public Object, public virtual PhysicsEntity {
|
|
|
|
public:
|
|
|
|
PhysicsObject(ObjectConfigConstPtr config, Json const& parameters = Json());
|
|
|
|
|
|
|
|
void enableInterpolation(float extrapolationHint = 0.0f) override;
|
|
|
|
void disableInterpolation() override;
|
|
|
|
|
|
|
|
void init(World* world, EntityId entityId, EntityMode mode) override;
|
|
|
|
void uninit() override;
|
|
|
|
|
2023-07-20 14:58:49 +00:00
|
|
|
void update(float dt, uint64_t currentStep) override;
|
2023-06-20 04:33:09 +00:00
|
|
|
|
|
|
|
RectF metaBoundBox() const override;
|
|
|
|
|
|
|
|
List<PhysicsForceRegion> forceRegions() const override;
|
|
|
|
|
|
|
|
size_t movingCollisionCount() const override;
|
|
|
|
Maybe<PhysicsMovingCollision> movingCollision(size_t positionIndex) const override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
struct PhysicsForceConfig {
|
|
|
|
PhysicsForceRegion forceRegion;
|
|
|
|
NetElementBool enabled;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct PhysicsCollisionConfig {
|
|
|
|
PhysicsMovingCollision movingCollision;
|
|
|
|
NetElementFloat xPosition;
|
|
|
|
NetElementFloat yPosition;
|
|
|
|
NetElementBool enabled;
|
|
|
|
};
|
|
|
|
|
|
|
|
OrderedHashMap<String, PhysicsForceConfig> m_physicsForces;
|
|
|
|
OrderedHashMap<String, PhysicsCollisionConfig> m_physicsCollisions;
|
|
|
|
|
|
|
|
RectF m_metaBoundBox;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|