Voxellancer  0.3
A game about voxels in space
 All Classes Functions Pages
aimer.h
1 #pragma once
2 
3 #include <unordered_set>
4 
5 #include "geometry/ray.h"
6 
7 #include "property/property.h"
8 
9 
10 class Voxel;
11 class WorldObject;
12 
13 /*
14  Identifies the position of the voxel a worldObject is aiming at
15 */
16 class Aimer {
17 public:
18  Aimer(WorldObject* worldObject);
19  void update(float deltaSec);
20 
21  glm::vec3 aim(const Ray& ray);
22 
23  void setWorldObject(WorldObject* worldObject);
24 
25 protected:
26  WorldObject* m_worldObject;
27  Property<float> m_infityAimDistance;
28  Property<float> m_infityAimInterpolation;
29  float m_lastDistance;
30 
31  glm::vec3 nearestTarget(const std::unordered_set<Voxel*>& voxels, const glm::vec3& origin) const;
32  float distanceTo(Voxel* voxel, const glm::vec3& origin) const;
33  glm::vec3 infinity(const Ray& ray) const;
34 };
35 
Definition: worldobject.h:43
Definition: aimer.h:16
Definition: voxel.h:15
Definition: ray.h:12