mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
fix: fatal error when 'body' or 'head' player bone not found
This commit is contained in:
parent
5d81323bd3
commit
0adc13d01a
1 changed files with 12 additions and 6 deletions
|
|
@ -162,13 +162,19 @@ void Player::postUpdate() {
|
|||
|
||||
skeleton.visible = currentCamera != camera;
|
||||
|
||||
size_t bodyIndex = skeleton.config->find("body")->getIndex();
|
||||
size_t headIndex = skeleton.config->find("head")->getIndex();
|
||||
auto body = skeleton.config->find("body");
|
||||
auto head = skeleton.config->find("head");
|
||||
|
||||
skeleton.pose.matrices[bodyIndex] =
|
||||
glm::rotate(glm::mat4(1.0f), glm::radians(cam.x), glm::vec3(0, 1, 0));
|
||||
skeleton.pose.matrices[headIndex] =
|
||||
glm::rotate(glm::mat4(1.0f), glm::radians(cam.y), glm::vec3(1, 0, 0));
|
||||
if (body) {
|
||||
skeleton.pose.matrices[body->getIndex()] = glm::rotate(
|
||||
glm::mat4(1.0f), glm::radians(cam.x), glm::vec3(0, 1, 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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue