00001 #ifndef COLLIDER_H
00002 #define COLLIDER_H
00003
00004 #include "Component.h"
00005 #include <iostream>
00006 #include "StandardIncludes.h"
00007
00008
00009 class GameObject;
00010 class Behaviour;
00011
00012 struct Ray{
00013 Vec3f origine;
00014 Vec3f direction;
00015 };
00016
00017 struct CollisionHit{
00018 Vec3f penetration;
00019 };
00020 struct RayCastHit;
00021
00022
00024 bool getClosestPointsOnRays(const Ray& ray1, const Ray ray2, Vec3f& point1, Vec3f& point2);
00025
00026 class Collider: public Component{
00027 public :
00028 static const RTTI TYPE;
00029 virtual const RTTI& getType() const{ return TYPE; }
00030
00031 public:
00032 Collider();
00033 virtual ~Collider();
00034 virtual void onCollisionEnter();
00035 virtual bool rayCast(const Ray& ray, RayCastHit& hit)const;
00036 virtual void renderGuizmo()const;
00037
00038 bool isStatic()const { return misStatic; }
00039 void isStatic(bool stat) { misStatic = stat; }
00040
00041 protected:
00042 bool misStatic;
00043 };
00044
00045 struct RayCastHit{
00046 Collider* collider;
00047 Vec3f intersection;
00048 };
00049
00050 #endif