-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSolver.h
More file actions
50 lines (37 loc) · 946 Bytes
/
Solver.h
File metadata and controls
50 lines (37 loc) · 946 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#ifndef SOLVER_H
#define SOLVER_H
#include "Vector2D.h"
/*
衝突応答(衝突時のオブジェクト同士のめり込みを解除するため) の
計算と移動処理を行うクラス
*/
class Collider;
class ColliderShape;
class Rigidbody;
class Elasticbody;
class Physicalbody;
class Solver
{
public:
Solver(ColliderShape *collA, ColliderShape *collB, Physicalbody *physA, Physicalbody *physB);
~Solver();
//めり込みを解除
void Solve();
Vector2D GetNormal(Physicalbody *phys) const
{
if (phys == _physA)
return _dA;
if (phys == _physB)
return _dB;
return Vector2D::zero;
}
private:
//どれくらいめり込んでるか計算
void CalcDumpScale();
//衝突したオブジェクト
ColliderShape *_collA, *_collB;
Physicalbody *_physA, *_physB;
//めり込みを解除するベクトル
Vector2D _d, _dA, _dB;
};
#endif