Skip to content

Add interpolation toggle to set_rotation - #17299

Open
An0n3m0us wants to merge 1 commit into
luanti-org:masterfrom
An0n3m0us:fixRotationHack
Open

Add interpolation toggle to set_rotation#17299
An0n3m0us wants to merge 1 commit into
luanti-org:masterfrom
An0n3m0us:fixRotationHack

Conversation

@An0n3m0us

@An0n3m0us An0n3m0us commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

Fixes: #16745
Related: luanti-org/minetest_game#3255

Add compact, short information about your PR for easier understanding:

  • Goal of the PR
  • How does the PR work?
  • Does it resolve any reported issue?
  • Does this relate to a goal in the roadmap?
  • If not a bug fix, why is this PR needed? What usecases does it solve?
  • If you have used an LLM/AI to help with code or assets, you must disclose this.

Adds optional interpolate parameter to set_rotation(rotation, interpolate). When false, rotation snaps instantly on the client instead of blending over ~100ms. Default true preserves existing behavior.

Needed to fix minetest_game#2950 and #2948 as the cart mod needs precise rotation timing that the engine's built-in interpolation prevents.

Kiro was used to assist with code writing of the laid out tasks plan, after investigating.

To do

This PR is a Ready for Review.

  • Property added, serialized, Lua-bound, client-side respected, backward compatibility sorted
  • Flag sent with AO_CMD_UPDATE_POSITION, backward compatible (extra byte, old clients ignore)
  • Client reads flag and uses rot_translator.init() vs .update()

How to test

-- Snaps instantly (no client blending)
self.object:set_rotation(vector.new(math.pi/4, 0, 0), false)

-- Smooth interpolation (default, same as before)
self.object:set_rotation(vector.new(math.pi/4, 0, 0))

@appgurueu appgurueu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for taking a stab!

Regarding the implementation details: I don't think this should be a property. Properties are for "persistent"-ish values, this is a very temporary value, usually tied to a specific set_rotation() call. (Furthermore, rotation is not part of the object properties; it would be a bit odd if a property relating specifically to rotation were.)

Thus I would prefer a parameter on set_rotation(), ending up in the same AO CMD as the rotation (AO_CMD_UPDATE_POSITION, somewhat misnamed).

For a first implementation, players can be ignored; calling set_rotation() on players probably should warn anyways, it doesn't do anything reasonable because it's instantly overwritten by client-provided yaw.

Issue this PR addresses: #16745

@An0n3m0us

Copy link
Copy Markdown
Contributor Author

hey thanks for the review, agreed, that makes a lot more sense! I've moved it from the entity level now to set_rotation instead. Updated respective minetest_game PR as well to pass in the bool on set_rotation.

@An0n3m0us An0n3m0us changed the title Add interpolation rotation bool to entities Add interpolation rotation toggle to set_rotation Jun 28, 2026
@An0n3m0us An0n3m0us changed the title Add interpolation rotation toggle to set_rotation Add interpolation toggle to set_rotation Jun 28, 2026
@Zughy Zughy added @ Script API Feature ✨ PRs that add or enhance a feature Roadmap: Needs approval The change is not part of the current roadmap and needs to be approved by coredevs beforehand labels Jun 28, 2026
@An0n3m0us
An0n3m0us requested a review from appgurueu July 23, 2026 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature ✨ PRs that add or enhance a feature Roadmap: Needs approval The change is not part of the current roadmap and needs to be approved by coredevs beforehand @ Script API

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Set rotation should have interpolation control Cart: Get rid of animation hack

3 participants