Skip to content

Commit

Permalink
Merge pull request #92152 from lawnjelly/fix_viewport_interpolation_mode
Browse files Browse the repository at this point in the history
[3.x] Fix Viewport interpolation mode
  • Loading branch information
lawnjelly authored May 20, 2024
2 parents f2b059c + 0f5cadf commit bb342cb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions doc/classes/Viewport.xml
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@
<member name="own_world" type="bool" setter="set_use_own_world" getter="is_using_own_world" default="false">
If [code]true[/code], the viewport will use a unique copy of the [World] defined in [member world].
</member>
<member name="physics_interpolation_mode" type="int" setter="set_physics_interpolation_mode" getter="get_physics_interpolation_mode" overrides="Node" enum="Node.PhysicsInterpolationMode" default="2" />
<member name="physics_object_picking" type="bool" setter="set_physics_object_picking" getter="get_physics_object_picking" default="false">
If [code]true[/code], the objects rendered by viewport become subjects of mouse picking process.
</member>
Expand Down
7 changes: 7 additions & 0 deletions scene/main/viewport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3681,6 +3681,13 @@ Viewport::Viewport() {
local_input_handled = false;
handle_input_locally = true;
physics_last_id = 0; //ensures first time there will be a check

// Physics interpolation mode for viewports is a special case.
// Typically viewports will be housed within Controls,
// and Controls default to PHYSICS_INTERPOLATION_MODE_OFF.
// Viewports can thus inherit physics interpolation OFF, which is unexpected.
// Setting to ON allows each viewport to have a fresh interpolation state.
set_physics_interpolation_mode(Node::PHYSICS_INTERPOLATION_MODE_ON);
}

Viewport::~Viewport() {
Expand Down

0 comments on commit bb342cb

Please sign in to comment.