summaryrefslogtreecommitdiff
path: root/engine-ocean/Game/Components/transformcomponent.h
blob: 7b6a5c236a0de0737286c0134022ac5a69ee18fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#ifndef TRANSFORMCOMPONENT_H
#define TRANSFORMCOMPONENT_H

#include "Game/Systems/aisystem.h"
#include "Graphics/global.h"
#include <memory>
#include "Component.h"

class TransformComponent : public Component
{
public:
    TransformComponent(std::shared_ptr<ModelTransform> mt,
                       std::string entity_id,
                       std::map<std::string, BlackboardData>& m_global_blackboard,
                       bool isAI = false);

    void translate(const glm::vec3 &delta);
    void setPos(const glm::vec3 &new_pos);
    void setScale(const glm::vec3 &scale);
    std::shared_ptr<ModelTransform> getMT();
    std::vector<std::shared_ptr<ModelTransform>> getAllMT();
    glm::vec3 getScale();
    //glm::vec3 getRotation();
    void setRotation(float angle, glm::vec3 axis);
    float getYRotationAngle();




    bool hasMultipleMT();
    glm::vec3 getPos();

    // used for collisions
    glm::vec3 old_pos;
    glm::vec3 estimated_final_pos;
    bool onGround = false;
    bool movingLaterally = false;
    float gravity = -25.f;
    float yVelocity = 0.f;



private:
    std::shared_ptr<ModelTransform> m_model_transform;
    std::vector<std::shared_ptr<ModelTransform>> m_all_model_transforms;
    bool multipleMT = false;
    std::map<std::string, BlackboardData>& m_global_blackboard;
    std::string m_entity_id;
    bool isAIObject = false;


};

#endif // TRANSFORMCOMPONENT_H