galaxy 1.0.0
Real-Time C++23 Game Programming Framework. Built on data-driven design principles and agile software engineering.
Loading...
Searching...
No Matches
PhysicsSystem.cpp
Go to the documentation of this file.
1
7
8#include <glm/trigonometric.hpp>
9
14
15#include "PhysicsSystem.hpp"
16
17namespace galaxy
18{
19 namespace systems
20 {
24
28
29 void PhysicsSystem::update(entt::registry& registry)
30 {
31 const auto group = registry.group<components::RigidBody>(entt::get<components::Transform>, entt::exclude<flags::Disabled>);
32 for (auto&& [entity, body, transform] : group.each())
33 {
34 const auto& pos = body.m_body->GetPosition();
35 transform.m_tf.set_pos(pos.x * GALAXY_BOX_TO_WORLD, pos.y * GALAXY_BOX_TO_WORLD);
36 transform.m_tf.set_rotation(glm::degrees(body.m_body->GetAngle()));
37 }
38 }
39 } // namespace systems
40} // namespace galaxy
Box2D physics body.
Definition RigidBody.hpp:34
virtual ~PhysicsSystem()
Destructor.
void update(entt::registry &registry) override
Abstract implementation for updating the system. Use the manager to retreive your components.
Timer.hpp galaxy.
Definition Async.hpp:17