Skip to content
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

Physics interpolation: Per node disabling in editor broken #90238

Closed
lubasowo0 opened this issue Apr 5, 2024 · 3 comments · Fixed by #90246
Closed

Physics interpolation: Per node disabling in editor broken #90238

lubasowo0 opened this issue Apr 5, 2024 · 3 comments · Fixed by #90246

Comments

@lubasowo0
Copy link

Tested versions

4.3.dev [29b3d9e] and [06abc86]

System information

Arch Linux - OpenGL API 4.6 (Core Profile) Mesa 24.0.4-arch1.2

Issue description

Not the main issue but On and Off in this line are swapped:

ADD_PROPERTY(PropertyInfo(Variant::INT, "physics_interpolation_mode", PROPERTY_HINT_ENUM, "Inherit,Off,On"), "set_physics_interpolation_mode", "get_physics_interpolation_mode");

The issue is that enabling Physics Interpolation in the project settings and then disabling it per node in the editor doesn't do anything, probably because canvas_item_set_interpolated never gets called at startup. Here are some workarounds I found which fix the issue:

  • Commenting out this early return:
    if (data.physics_interpolated == p_interpolated) {
  • Calling canvas_item_set_interpolated manually:
func _ready() -> void:
	RenderingServer.canvas_item_set_interpolated(get_canvas_item(), false)
  • Setting PHYSICS_INTERPOLATION_MODE_OFF at runtime:
func _ready() -> void:
	#PHYSICS_INTERPOLATION_MODE_OFF is NOT set in the editor, if it is this doesn't work,
	#probably because of early returns
	physics_interpolation_mode = PHYSICS_INTERPOLATION_MODE_OFF

Steps to reproduce

  • enable Physics Interpolation and set low ticks per seconds, for example 5
  • add Sprite2d with a script to update a position in _process (not _physics_process) to introduce visible jitter with interpolation and low ticks per seconds
  • in editor disable the interpolation for the sprite (options are swapped without fixing that line above)
  • the sprite still jitters

Minimal reproduction project (MRP)

project.zip

Copy link

github-actions bot commented Apr 5, 2024

Hello from the maintainer team!

First of all, thank you for taking the time to report an issue here.

In case you haven't already, be sure to attach an MRP (minimal reproduction project) if specific steps or assets are needed in order to reproduce the issue. Contributors will use the MRP to validate that the fix is working as intended.

The time it will take to assess and fix your issue may vary. Follow the blog about our new releases and pre-releases to track new fixes or go to our forum where users could help you in the meantime.

Thank you for your patience.

@lawnjelly
Copy link
Member

lawnjelly commented Apr 5, 2024

This bug is not present in 3.x, just tested. @rburing
I'll try and help but may be away for few days. It is probably something very simple.

UPDATE:
It's probably this:
data.physics_interpolated defaults to false in 4.x, and true in 3.x.

data.physics_interpolated = false;

(I can't test and make PR due to lack of time, but feel free. 👍 )

@rburing
Copy link
Member

rburing commented Apr 5, 2024

Thanks a lot for catching this during the dev phase! 👍

@AThousandShips AThousandShips added this to the 4.3 milestone Apr 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants