-
Notifications
You must be signed in to change notification settings - Fork 314
Add game speed controls to the embedded game window #1346
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -57,8 +57,8 @@ constexpr double HINGE_DEFAULT_RELAXATION = 1.0; | |
| double estimate_physics_step() { | ||
| Engine *engine = Engine::get_singleton(); | ||
|
|
||
| const double step = 1.0 / engine->get_physics_ticks_per_second(); | ||
| const double step_scaled = step * engine->get_time_scale(); | ||
| const double step = 1.0 / engine->get_user_physics_ticks_per_second(); | ||
| const double step_scaled = step * engine->get_effective_time_scale(); | ||
|
Comment on lines
+60
to
+61
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift Refresh hinge motor torque when the effective step changes. Line 61 now changes during a game-view speed update. Store the requested impulse and recalculate the Jolt torque limit when the effective physics step changes. 🤖 Prompt for AI Agents |
||
|
|
||
| return step_scaled; | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -213,6 +213,13 @@ Error SceneDebugger::_msg_next_frame(const Array &p_args) { | |
| return OK; | ||
| } | ||
|
|
||
| Error SceneDebugger::_msg_speed_changed(const Array &p_args) { | ||
| ERR_FAIL_COND_V(p_args.is_empty(), ERR_INVALID_DATA); | ||
| double time_scale_user = p_args[0]; | ||
| Engine::get_singleton()->set_user_time_scale(time_scale_user); | ||
| return OK; | ||
|
Comment on lines
+216
to
+220
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win Validate the time-scale value before applying it. Line 217 only rejects an empty array. A non-finite value can reach Require one numeric, finite argument before updating the engine. 🤖 Prompt for AI Agents |
||
| } | ||
|
|
||
| Error SceneDebugger::_msg_debug_mute_audio(const Array &p_args) { | ||
| ERR_FAIL_COND_V(p_args.is_empty(), ERR_INVALID_DATA); | ||
| bool do_mute = p_args[0]; | ||
|
|
@@ -530,6 +537,7 @@ void SceneDebugger::_init_message_handlers() { | |
| message_handlers["clear_selection"] = _msg_clear_selection; | ||
| message_handlers["suspend_changed"] = _msg_suspend_changed; | ||
| message_handlers["next_frame"] = _msg_next_frame; | ||
| message_handlers["speed_changed"] = _msg_speed_changed; | ||
| message_handlers["debug_mute_audio"] = _msg_debug_mute_audio; | ||
| message_handlers["override_cameras"] = _msg_override_cameras; | ||
| message_handlers["transform_camera_2d"] = _msg_transform_camera_2d; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Reset the UI state when GameView is hidden.
Line 627 returns before resetting
time_scale_indexor button state. If a game restarts while GameView is hidden, the new session uses1.0×but the GameView can still show the previous speed.Reset the local state and button state before the visibility guard. Keep the debugger message behind the guard if that behavior is intentional.
🤖 Prompt for AI Agents