From 0f5cadfb56100a02c45637fc2db436d3c0ffcd74 Mon Sep 17 00:00:00 2001 From: lawnjelly Date: Mon, 20 May 2024 08:56:04 +0100 Subject: [PATCH] Fix Viewport interpolation mode Viewport interpolation mode is a special case, which should be set to ON instead of INHERIT. --- doc/classes/Viewport.xml | 1 + scene/main/viewport.cpp | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/doc/classes/Viewport.xml b/doc/classes/Viewport.xml index 1adde175aa4..c1018551871 100644 --- a/doc/classes/Viewport.xml +++ b/doc/classes/Viewport.xml @@ -246,6 +246,7 @@ If [code]true[/code], the viewport will use a unique copy of the [World] defined in [member world]. + If [code]true[/code], the objects rendered by viewport become subjects of mouse picking process. diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index ef92a88fadd..74680b195d0 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -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() {