KisaragiLibrary
 
読み取り中…
検索中…
一致する文字列を見つけられません
Collision.hpp
[詳解]
1#pragma once
2
3#include "ComponentBase.hpp"
4#include "Const.h"
5#include <array>
6#include <vector>
7#include "Matrix2D.hpp"
8#include "Kisaragi_Math.hpp"
9#include "Primitive.hpp"
10#include "GameObj.hpp"
12#include "CollisionQueue.hpp"
13
14using std::vector;
15
16
17
18//TODO 葤ɂhitʒm
19
20//TODO SATOɎlpƂŎGȉZǁA4؂CȂŏȗ
21
22namespace Kisaragi_Lib
23{
25 {
26 public:
27 bool hit;
28
30 {
31
32 }
33
35 {
36
37 }
38
39
40 //蔻菈sĂȂȂExits
41
42
43 //AABBƂ̓蔻s
44
45 };
46
48 {
49 public:
51
53
54
55 //bool CollidesWith(AABBCollision2D* _other)
56 //{
57 // bool result = false;
58
59 // //[hW߂
60 // Point2D<double> thisLehtTop = gameObj->transform.position + aabb.LeftTopPoint();
61 // Point2D<double> thisRightBottom = gameObj->transform.position + aabb.RightBottomPoint();
62
63 // Point2D<double> otherLeftTop = _other->gameObj->transform.position + _other->aabb.LeftTopPoint();
64 // Point2D<double> otherRightBottom = _other->gameObj->transform.position + _other->aabb.RightBottomPoint();
65
66
67 // //_other̉E[[Eɂ邩?
68 // if (thisLehtTop.x <= otherRightBottom.x
69 // //_other̍[E[荶ɂ邩?
70 // && thisRightBottom.x >= otherLeftTop.x)
71 // {
72 //
73 // //_other̉[[艺ɂ邩?
74 // if (thisLehtTop.y <= otherRightBottom.y
75 // //_otheȑ[[ɂ邩?
76 // && thisRightBottom.y >= otherLeftTop.y)
77 // {
78 // result = true;
79 // Hit(_other);
80 // }
81 // }
82
83 // return result;
84 //}
85
86 };
87
88
89
90
91
92
93
94 //class CollisionCheck
95 //{
96 //public:
97 // static bool Collision(BoxCollision2D _obj1, BoxCollision2D _obj2)
98 // {
99 // // OBB vs OBB
100 // //bool CollisionTest_OBB_OBB(Vector2[] vertsA, Vector2[] vertsB)
101 //
102 // //Ql https://www.eproph527tw.com/i3dprg/ch02/sec221.html
103 // //4p`̕ӂ̃xNg߂(͕slӌ`̂ݑΉ.ɂΉΕӂ̗ʂ𑝂₵Ă)
104 // std::vector<Vector2<double>> sideDirs;
105
106 //
107 //
108 // //Qlł͐KĂ邯njʂ͕ςȂ̂łȂėǂ
109 //
110 // //slӌ`A̕ӃxNg߂
111 // sideDirs.push_back(_obj1.boxVertex[0] - _obj1.boxVertex[1]);
112 // sideDirs.push_back(_obj1.boxVertex[1] - _obj1.boxVertex[2]);
113 // //slӌ`B̕ӃxNg߂
114 // sideDirs.push_back(_obj2.boxVertex[0] - _obj2.boxVertex[1]);
115 // sideDirs.push_back(_obj2.boxVertex[1] - _obj2.boxVertex[2]);
116 //
117
118 // for(auto& u : sideDirs)
119 // {
120 // float minA = _obj1.boxVertex[0].x * u.x + _obj1.boxVertex[0].y * u.y;
121 // float maxA = minA;
122 // float minB = _obj2.boxVertex[0].x * u.x + _obj2.boxVertex[0].y * u.y;
123 // float maxB = minB;
124
125 // //ӂ̃xNgƂāAˉeԂ߂
126 // for (int i = 1; i < 4; i++)
127 // {
128 // float projA = _obj1.boxVertex[i].x * u.x + _obj1.boxVertex[i].y * u.y;
129 // if (projA < minA) { minA = projA; }
130 // else if (projA > maxA) { maxA = projA; }
131
132 // float projB = _obj2.boxVertex[i].x * u.x + _obj2.boxVertex[i].y * u.y;
133 // if (projB < minB) { minB = projB; }
134 // else if (projB > maxB) { maxB = projB; }
135 // }
136
137 // //ˉeԂɃMbv΁AՓ˂͂ȂƔfAfalseԂ܂B
138 // if (maxB < minA || maxA < minB)
139 // {
140 // return false;
141 // }
142 // }
143
144 // return true;
145 //
146 // }
147 //};
148
149
150
151
152
153
154
155}
図形の形状を表すためのクラスを提供するヘッダ
AABBCollision2D(AABB< double > _aabb)
Definition Collision.hpp:52
AABB< double > aabb
Definition Collision.hpp:50
bool hit
Definition Collision.hpp:27
~Collision2DBase()
Definition Collision.hpp:34
Collision2DBase()
Definition Collision.hpp:29
Definition ComponentBase.hpp:24
Definition Accessor.hpp:110
軸平行境界ボックス
Definition Primitive.hpp:460