ecsgame/ECS/Systems/PositionDebugSystem.h
karl 9125e7a3cc Add origin vector to Transform
We need this in addition to the Matrix (which includes translation) - mainly for rotation, which should be around the translation, but not around the origin.

There may be some places left which need changes due to this - the line between the origin and translation isn't as clear yet as it should be.
2020-09-29 21:04:25 +02:00

29 lines
745 B
C++

//
// Created by karl on 04.01.20.
//
#ifndef ECSGAME_POSITIONDEBUGSYSTEM_H
#define ECSGAME_POSITIONDEBUGSYSTEM_H
#include <iostream>
#include "../ECS.h"
#include "../Components/Transform.h"
using namespace ECS;
class PositionDebugOutputSystem : public EntitySystem {
public:
void tick(World *pWorld, float deltaTime) override {
pWorld->each<Transform>([&](Entity *ent, ComponentHandle<Transform> transform) {
std::cout << ent->getEntityId() << ": "
<< transform->get_origin().x << ", "
<< transform->get_origin().y << ", "
<< transform->get_origin().z
<< std::endl;
});
}
};
#endif //ECSGAME_POSITIONDEBUGSYSTEM_H