#include "game.h" /* This is where implementations of misc. game objects goes */ /* At the moment, these have to be axis-aligned, like Minecraft */ bool FloorPanel::is_inside(vec3 pos, float margin) { for(auto m : models){ /* How close is the floor panel represented by m? */ vec3 size = vec3(m[0][0], m[1][1], m[2][2]); vec3 cmpos = vec3(m[3][0], m[3][1], m[3][2]); /* Is it inside? */ if(fabs(cmpos.x - pos.x) < size.x/2 + margin && fabs(cmpos.y - pos.y) < size.y/2 + margin && fabs(cmpos.z - pos.z) < size.z/2 + margin) return true; } return false; }