-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathJoint.cpp
40 lines (33 loc) · 852 Bytes
/
Joint.cpp
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
#include "Joint.h"
#include "GLFWApp.h"
// Joint
Joint::Joint(std::string name) : m_offset_from_parent(glm::vec3(0,0,0)), m_num_channels(0), m_parent(nullptr)
{
GameObject::setName(name);
for (int i = 0; i < 6; ++i)
m_joint_limit[i] = { 0,0 };
}
Joint::~Joint()
{
}
void Joint::Initialize()
{
GameObject::Initialize();
}
void Joint::Initialize(Transform& trans)
{
auto resource_manager = GLFWApp::getInstance()->getResourceManager();
const auto mesh_list = resource_manager->getMeshes();
// TODO: remember to replace this with findMesh(name) / setMesh()
auto mesh = mesh_list[2];
GameObject::Initialize(trans.m_translation);
}
void Joint::setParent(std::shared_ptr<Joint> parent)
{
m_parent = parent;
m_transform.setParent(&(parent->m_transform));
}
void Joint::AddChild(std::shared_ptr<Joint> child)
{
m_childs.push_back(child);
}