불안정하게 멀티 됨.. 일단은 두번째 플레이어가 첫번째 플레이어한테 보이기는 하니까...

This commit is contained in:
2025-06-15 22:36:04 +09:00
parent 06a1e41dc8
commit 711fc4c93d
11 changed files with 328 additions and 77 deletions

View File

@@ -31,17 +31,27 @@ void Tick(veng::Engine& engine, std::float_t delta_time) {
(-stiffness * displacement - damping * camera_lag->linear_velocity) *
delta_time;
camera_lag->linear_velocity = glm::vec3(0);
camera_lag->position = player->position;
engine.view = glm::lookAt(
glm::vec3(camera_lag->position.x, camera_lag->position.y, -5.f),
camera_lag->position, glm::vec3(0.f, -1.f, 0.f));
static bool w_laststate = false;
if (glfwGetKey(engine.vulkan_graphics->window->GetHandle(), GLFW_KEY_W) ==
GLFW_PRESS) {
player->linear_acceleration = glm::normalize(forward) * 10.f;
player_flame->visible = true;
player->needsUpdate = true;
w_laststate = true;
} else {
player->linear_acceleration = forward * .0f;
player_flame->visible = false;
if (w_laststate) {
player->needsUpdate = true;
w_laststate = false;
}
}
if (bullet_cooldown > std::numeric_limits<std::float_t>::epsilon()) {
@@ -60,21 +70,33 @@ void Tick(veng::Engine& engine, std::float_t delta_time) {
bullet->owner = player;
bullet->scale = player->scale;
bullet->colision = true;
bullet->networkReplicated = true;
bullet->needsUpdate = true;
spdlog::info("bullet address: {}", (void*)bullet);
}
}
static bool ad_laststate = false;
if (glfwGetKey(engine.vulkan_graphics->window->GetHandle(), GLFW_KEY_A) ==
GLFW_PRESS) {
right = player->rotation * glm::vec3(0, 0, 1);
player->angular_velocity = right * 6.f;
player->needsUpdate = true;
ad_laststate = true;
} else if (glfwGetKey(engine.vulkan_graphics->window->GetHandle(),
GLFW_KEY_D) == GLFW_PRESS) {
right = player->rotation * glm::vec3(0, 0, 1);
player->angular_velocity = right * -6.f;
player->needsUpdate = true;
ad_laststate = true;
} else {
right = player->rotation * glm::vec3(0, 0, 1);
player->angular_velocity = right * 0.f;
if (ad_laststate) {
player->needsUpdate = true;
ad_laststate = false;
}
}
player_flame->rotation = player->rotation;