Added new Johan Code

This commit is contained in:
2016-05-20 13:00:04 +02:00
parent 1120a3e144
commit a8415db4ac
24 changed files with 2287 additions and 32 deletions
+13
View File
@@ -8,6 +8,8 @@
Entity::Entity()
{
model = NULL;
scale = 1;
canCollide = true;
}
@@ -34,3 +36,14 @@ void Entity::draw()
}
bool Entity::inObject(const Vec3f & point)
{
if (!model)
return false;
Vec3f center = position + model->center;
float distance = sqrt((point.x - center.x) * (point.x - center.x) + (point.z - center.z)*(point.z - center.z));
if (distance < model->radius*scale)
return true;
return false;
}