Check if weapon collision point is inside enemy and do weapon damage

This commit is contained in:
jancoow
2016-06-21 17:00:36 +02:00
parent 0a0fdfc8b1
commit 4249e35653
7 changed files with 33 additions and 7 deletions
+3 -2
View File
@@ -10,7 +10,7 @@
Weapon::Weapon(std::string modelFilename, float scale, Vec3f location, Vec2f rotation,
Vec3f offsetPlayer, Vec3f ankerPoint,
Vec3f offsetPlayer, Vec3f ankerPoint, Vec3f collisionPoint,
Vec2f maxRotation, Vec2f minRotation){
weaponmodel = Model::load(modelFilename);
rotate(rotation);
@@ -21,6 +21,7 @@ Weapon::Weapon(std::string modelFilename, float scale, Vec3f location, Vec2f rot
this->ankerPoint = ankerPoint;
this->maxRotation = maxRotation;
this->minRotation = minRotation;
this->collisionPoint = collisionPoint;
};
Weapon::~Weapon(){
@@ -72,7 +73,7 @@ void Weapon::draw(){
//Test code for finding anker point
glColor3ub(255, 255, 0);
glTranslatef(ankerPoint.x, ankerPoint.y, ankerPoint.z);
glTranslatef(collisionPoint.x, collisionPoint.y, collisionPoint.z);
glBegin(GL_LINES);
glVertex2f(0, 4);
glVertex2f(0, -4);