fix: fatal error when 'body' or 'head' player bone not found
This commit is contained in:
parent
5d81323bd3
commit
0adc13d01a
@ -162,13 +162,19 @@ void Player::postUpdate() {
|
|||||||
|
|
||||||
skeleton.visible = currentCamera != camera;
|
skeleton.visible = currentCamera != camera;
|
||||||
|
|
||||||
size_t bodyIndex = skeleton.config->find("body")->getIndex();
|
auto body = skeleton.config->find("body");
|
||||||
size_t headIndex = skeleton.config->find("head")->getIndex();
|
auto head = skeleton.config->find("head");
|
||||||
|
|
||||||
skeleton.pose.matrices[bodyIndex] =
|
if (body) {
|
||||||
glm::rotate(glm::mat4(1.0f), glm::radians(cam.x), glm::vec3(0, 1, 0));
|
skeleton.pose.matrices[body->getIndex()] = glm::rotate(
|
||||||
skeleton.pose.matrices[headIndex] =
|
glm::mat4(1.0f), glm::radians(cam.x), glm::vec3(0, 1, 0)
|
||||||
glm::rotate(glm::mat4(1.0f), glm::radians(cam.y), glm::vec3(1, 0, 0));
|
);
|
||||||
|
}
|
||||||
|
if (head) {
|
||||||
|
skeleton.pose.matrices[head->getIndex()] = glm::rotate(
|
||||||
|
glm::mat4(1.0f), glm::radians(cam.y), glm::vec3(1, 0, 0)
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::teleport(glm::vec3 position) {
|
void Player::teleport(glm::vec3 position) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user