-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCollision.cpp
More file actions
38 lines (37 loc) · 1.01 KB
/
Copy pathCollision.cpp
File metadata and controls
38 lines (37 loc) · 1.01 KB
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
#include "Collision.h"
#include "Component/Phys/Collider.h"
namespace sh::game
{
Collision::Collision(const std::array<phys::ContactPoint, ARRAY_SIZE>& contactPoints)
{
contacts = contactPoints;
}
Collision::Collision(std::vector<phys::ContactPoint>&& contactPoints)
{
contacts = std::move(contactPoints);
}
Collision::Collision(Collision&& other) noexcept :
collider(other.collider),
contactCount(other.contactCount),
contacts(std::move(other.contacts))
{
}
SH_GAME_API auto Collision::operator=(Collision&& other) noexcept -> Collision&
{
collider = other.collider;
contactCount = other.contactCount;
contacts = std::move(other.contacts);
return *this;
}
SH_GAME_API void Collision::PushReferenceObjects(core::GarbageCollection& gc)
{
gc.PushReferenceObject(collider);
}
SH_GAME_API auto Collision::GetContactPoint(uint32_t idx) const -> const phys::ContactPoint&
{
if (contacts.index() == 0)
return std::get<0>(contacts)[idx];
else
return std::get<1>(contacts)[idx];
}
}//namespace