-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathHitbox.h
63 lines (52 loc) · 1.88 KB
/
Hitbox.h
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
55
56
57
58
59
60
61
62
63
#pragma once
#include "irrlicht.h"
#include "IrrManagers.h"
#include "Vector2D.h"
#include "Vector3D.h"
#include "LuaLime.h"
#include "DebugVisual.h"
#include <string>
#include <vector>
#include "Compatible3D.h"
#include "DrawSphere.h"
class Hitbox : public Compatible3D {
public:
irr::scene::IMeshSceneNode* node = 0;
irr::scene::ISceneNode* holder = 0;
float radius;
float height;
int lod = 1; // 0 - Low poly, 1 - Medium, 2 - Highest (affects rings and sectors only, does not affect collision performance with other hitboxes)
bool active = true;
bool visible = false;
bool collision = false;
irr::scene::ISceneNode* getNode() const override { return holder; }
Hitbox();
Hitbox(int rad, int h);
Hitbox(const Hitbox& other);
Vector3D getPosition();
void setPosition(const Vector3D& pos);
Vector3D getRotation();
void setRotation(const Vector3D& rot);
bool getActive();
void setActive(bool active); // Active hitbox turns the hitbox yellow, otherwise blue (but if it is not visible then the capsule will not be rendered at all)
bool getVisible();
void setVisible(bool visible); // Sets vertex opacity to 255; hitboxes will always be truly visible
int getLOD();
void setLOD(int i); // Calls construct if LOD is different than lod member variable
bool getCollision();
void setCollision(bool enable); // If enabled, will be interactable with raypicks etc.
int getID();
void setID(int id);
float getRadius();
void setRadius(float r);
float getHeight();
void setHeight(float h);
Vector2D getAttributes();
void setAttributes(const Vector2D& att);
void updateMaterial(bool updateOpacity, bool updateColor); // Update material based on attributes
void construct();
bool overlaps(const Hitbox& other);
bool pointInside(const Vector3D& point);
void destroy();
};
void bindHitbox();