无数据
订阅者
+124 小时
+107 天
+11830 天
帖子存档
ImGui::Checkbox("Unlimited Fly", &FlyController::Enabled); if (FlyController::Enabled) { ImGui::SliderFloat( "Fly Speed", &FlyController::Speed, 1.0f, 30.0f ); }
#pragma once #include <algorithm> namespace FlyController { inline bool Enabled = false; inline float Speed = 5.0f; struct Vec3 { float x, y, z; }; inline void Update( Vec3& position, float forward, float right, float vertical, float deltaTime ) { if (!Enabled || deltaTime <= 0.0f) return; const float speed = std::clamp(Speed, 0.0f, 100.0f); const float dt = std::min(deltaTime, 0.1f); position.x += right * speed * dt; position.y += vertical * speed * dt; position.z += forward * speed * dt; } }
