Engine
Frameworkcreatedbymeusableforthecreationofsimplegames.CurrentlysupportsOpenGL(Verysimple)andVulkan.
RaycastCallback.hpp
Go to the documentation of this file.
1 #pragma once
2 
5 
6 #include <ThirdParty/Box2D/Box2D/Box2D.h>
7 
8 namespace Engine
9 {
10  class CollisionSystem;
11 
16  class RayCastClosestCallback : public b2RayCastCallback
17  {
18  friend class CollisionSystem;
19  public:
21  RayCastClosestCallback(const CollisionLayer detectLayers);
22 
34  float32 ReportFixture(b2Fixture* fixture, const b2Vec2& point, const b2Vec2& normal, float32 fraction) override;
35 
36  private:
37  eastl::weak_ptr<Entity> entity;
38  bool hit;
39  b2Vec2 point;
40  b2Vec2 normal;
41  CollisionLayer detectionLayers;
42  };
43 
49  class RayCastMultipleCallback : public b2RayCastCallback
50  {
51  friend class CollisionSystem;
52  public:
53  enum
54  {
55  MAX_COUNT = 5
56  };
57 
58  // Structors
61  RayCastMultipleCallback(const CollisionLayer detectLayers);
62 
70  float32 ReportFixture(b2Fixture* fixture, const b2Vec2& point, const b2Vec2& normal, float32) override;
71 
72  private:
73  std::weak_ptr<Entity> entities;
74  b2Vec2 points[MAX_COUNT];
75  b2Vec2 normals[MAX_COUNT];
76  CollisionLayer detectionLayers;
77  int32 count;
78  };
79 } //namespace Engine
float32 ReportFixture(b2Fixture *fixture, const b2Vec2 &point, const b2Vec2 &normal, float32 fraction) override
Function used by Box2D to tell the Callback class that the ray has collided with a fixture...
Gets the all entities hit by the ray Callback class used to get collision data from ray queries NOTE:...
Gets the first entity hit by the ray Callback class used to get collision data from ray queries ...
The Collision System handles and stores run-time collision data using the Box2D library ...
CollisionLayer
Bitmask Enum that allows for layered collision checking