-
-
Notifications
You must be signed in to change notification settings - Fork 205
Added Fixed Physics Steps feature and Renamed the 'Use Frame Rate' to… #1992
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
Open
vuaieo
wants to merge
13
commits into
UPBGE:master
Choose a base branch
from
vuaieo:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
… 'FPS Limit' because its the most common describtions in any game engine to understand what it do... and moved it to the Game Physics panel in Scene properties editor becuase it affects the physics fundamentaly when using Variable mode
Collaborator
|
Hello, I quickly tested, it sounds ~ok overhaul but there are several things to fix. In my human vocabulary:
EDIT: I edited my review because timescale and external clock time were taken into account On my side, I will change UpdateSoftBody function name to UpdateSoftBodyRenderedShape |
…dded colons on the end of the label of the fixed timestep method so is same like others. fixed the stuttering when using fixed physics mode
changed files which caused the git clone problem
refactored for clarity and etc.
refactored all the code for fixed physics and variable physics modes so they would not have shared code and so would not interfere with each other...
1. fixed the logic rate , it was still tied together with frames and not physics, now is with physics steps (industry standart) 2. fixed the game would speed up if FPS > than physics steps
fixed UI and removed redundant/leftover code...
[Root cause] In camera view, rendering stayed entirely inside the game rasterizer so the interpolated transform from KX_Scene::ApplyPhysicsInterpolation() was displayed directly. In non-camera viewport mode, KX_Scene::ViewportRender() called Blender’s wm_draw_update(), which redraws the 3D View using the depsgraph’s evaluated matrices. Those matrices were still the raw physics poses because KX_GameObject::TagForTransformUpdateEvaluated() only copied the SG transform for dupli tagging and never injected the interpolated state. [Fix implemented] KX_GameObject::ApplyPhysicsInterpolation() now caches the interpolated MT_Transform, and KX_GameObject::TagForTransformUpdateEvaluated() chooses that cached transform when UseViewportRender() is active. It applies the matrix to both the original Object and its evaluated copy via BKE_object_apply_mat4(...) and tags ID_RECALC_TRANSFORM, ensuring wm_draw_update() draws the interpolated pose.
[Always clear on interpolation frames] KX_KetsjiEngine::NextFrameFixed() now runs scene->ClearPhysicsInterpolationState() every frame when interpolation is enabled, ensuring no stale render transforms even if physics didn’t advance (source/gameengine/Ketsji/KX_KetsjiEngine.cpp:800-807). [Store only when needed] StorePhysicsInterpolationState() remains conditional on physics advancement or initialization, keeping the heavier snapshot pass to a minimum while preserving correctness (KX_KetsjiEngine.cpp:808-813). [Per-scene tracking] KX_Scene now keeps m_interpolatedObjects plus RegisterInterpolatedObject() / UnregisterInterpolatedObject() so only objects that actually interpolated in the last frame need clearing (source/gameengine/Ketsji/KX_Scene.h:150-435, KX_Scene.cpp:552-574). [Automatic registration] KX_GameObject::ApplyPhysicsInterpolation() registers itself the first time it interpolates; StorePhysicsInterpolationState() and ClearPhysicsInterpolationState() unregister by clearing the cached flag, keeping the scene list accurate and preventing redundant work (source/gameengine/Ketsji/KX_GameObject.cpp:1842-1904). [Targeted clearing] KX_Scene::ClearPhysicsInterpolationState() now iterates m_interpolatedObjects and only falls back to the full object list when no tracked entries exist, then resets the vector to reclaim memory (KX_Scene.cpp:150-164). [Visibility gating] Optional skip for invisible objects avoids interpolation work when m_skipInvisibleInterpolation is true (default), while setters allow opting back in if a project needs interpolation even for culled items (KX_Scene.cpp:137-147, 585-593). [Documentation] Added inline comments explaining caching, restoration, visibility gating, and default behaviors to help new contributors follow the logic.
for fixed physics mode
refactored/addresses youles wishes
fixed padding to follow blender standarts
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
… 'FPS Limit' because its the most common describtions in any game engine to understand what it do... and moved it to the Game Physics panel in Scene properties editor becuase it affects the physics fundamentaly when using Variable mode