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

[3.x] Physics Interpolation - 3D shifting origin support #92469

Draft
wants to merge 1 commit into
base: 3.x
Choose a base branch
from

Conversation

lawnjelly
Copy link
Member

@lawnjelly lawnjelly commented May 28, 2024

  • Adds support for moving origin via instance_transform_physics_interpolation().

Discussion

Once auto-resets are added for 3D, it becomes necessary to add explicit support for moving origins, as moving origin worlds (for large world support) cannot be achieved easily without this.

ToDo

Still need to add support to call the VisualServer functions from VisualInstance, and support Cameras (which will work differently as of #92784).

@lawnjelly lawnjelly added this to the 3.x milestone May 28, 2024
@lawnjelly lawnjelly changed the title [3.x] Physics Interpolation - Auto-resets for 3D [3.x] Physics Interpolation - 3D Auto-resets & shifting origin support May 28, 2024
@lawnjelly lawnjelly marked this pull request as ready for review May 28, 2024 16:38
@lawnjelly lawnjelly requested review from a team as code owners May 28, 2024 16:38
Copy link
Member

@Calinou Calinou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested locally on https://github.com/godotengine/godot-demo-projects/tree/3.x/3d/kinematic_character, it works as expected.

Before

Both videos use 4x slowdown and 10 physics ticks per second.

reset_before.mp4

After

reset_after.mp4

Comment on lines 132 to 134
Transforms both the current and previous stored transform for a camera.
This allows transforming a camera without creating a "glitch" in the interpolation.
This is particularly useful for large worlds utilising a shifting origin.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Each linebreak creates a new paragraph (which takes space), so I think this makes more sense as a single paragraph:

Suggested change
Transforms both the current and previous stored transform for a camera.
This allows transforming a camera without creating a "glitch" in the interpolation.
This is particularly useful for large worlds utilising a shifting origin.
Transforms both the current and previous stored transform for a camera. This allows transforming a camera without creating a "glitch" in the interpolation. This is particularly useful for large worlds utilising a shifting origin.

Comment on lines 1622 to 1624
Transforms both the current and previous stored transform for an instance.
This allows transforming an instance without creating a "glitch" in the interpolation.
This is particularly useful for large worlds utilising a shifting origin.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Transforms both the current and previous stored transform for an instance.
This allows transforming an instance without creating a "glitch" in the interpolation.
This is particularly useful for large worlds utilising a shifting origin.
Transforms both the current and previous stored transform for an instance. This allows transforming an instance without creating a "glitch" in the interpolation. This is particularly useful for large worlds utilising a shifting origin.

@@ -121,6 +121,13 @@ void Camera::_notification(int p_what) {
if (doppler_tracking != DOPPLER_TRACKING_DISABLED) {
velocity_tracker->update_position(get_global_transform().origin);
}

// Auto-reset when first adding to the tree, as a convenience.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Auto-reset when first adding to the tree, as a convenience.
// Auto-reset when first adding to the tree, as a convenience.

@lawnjelly
Copy link
Member Author

Just making this draft temporarily as I've moved some of the auto-reset functionality to #92784. (Otherwise it is impossible to keep the changes in sync).

I'll probably edit this PR to include just the moving origin support as that is fairly self-contained.

@lawnjelly lawnjelly marked this pull request as draft June 7, 2024 09:29
@lawnjelly lawnjelly changed the title [3.x] Physics Interpolation - 3D Auto-resets & shifting origin support [3.x] Physics Interpolation - 3D shifting origin support Jun 7, 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 this pull request may close these issues.

2 participants