Remove collider when noclip

This commit is contained in:
MrLetsplay 2022-11-19 17:26:59 +01:00
parent 1a6678537f
commit 37f46a2b94

View File

@ -47,6 +47,11 @@ static void defaultKeyCallback(GLFWwindow *window, int key, int scancode, int ac
if(key == Input::getKeyBinding(keyToggleNoclip).key && action == GLFW_PRESS) { if(key == Input::getKeyBinding(keyToggleNoclip).key && action == GLFW_PRESS) {
kekData.player->noclip = !kekData.player->noclip; kekData.player->noclip = !kekData.player->noclip;
kekData.player->controller = kekData.player->noclip ? (PlayerController *) noclipController : (PlayerController *) defaultController; kekData.player->controller = kekData.player->noclip ? (PlayerController *) noclipController : (PlayerController *) defaultController;
if(kekData.player->noclip) {
kekData.physics->world->removeRigidBody(kekData.player->physics->body);
}else {
kekData.physics->world->addRigidBody(kekData.player->physics->body);
}
} }
} }