-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathHitbox.cpp
More file actions
executable file
·41 lines (35 loc) · 1.1 KB
/
Hitbox.cpp
File metadata and controls
executable file
·41 lines (35 loc) · 1.1 KB
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
#include "Hitbox.h"
Hitbox::Hitbox(float length, float width, float height, float x_offset, float y_offset, float z_offset) {
this->length = length;
this->width = width;
this->height = height;
this->x_offset = x_offset;
this->y_offset = y_offset;
this->z_offset = z_offset;
computePoints();
}
void Hitbox::computePoints() {
points.clear();
points.push_back(Vector(length, height, width));
points.push_back(Vector(length, height, -width));
points.push_back(Vector(-length, height, -width));
points.push_back(Vector(-length, height, width));
points.push_back(Vector(length, -height, width));
points.push_back(Vector(length, -height, -width));
points.push_back(Vector(-length, -height, -width));
points.push_back(Vector(-length, -height, width));
for (int i = 0; i < 8; i++) {
points[i].X += x_offset;
points[i].Z += y_offset; // plugin uses Y axis as up
points[i].Y += z_offset; // Z axis of the game is up
}
}
void Hitbox::getPoints(std::vector<Vector> & pts)
{
pts.clear();
for (int i = 0; i < 8; i++)
pts.push_back(points[i]);
}
Hitbox::~Hitbox()
{
}