Skip to content

docs: note what a flipped part does to a part attachment - #254

Merged
MasamiYitsuse merged 1 commit into
developfrom
docs/attachment-mirror-caveat
Aug 2, 2026
Merged

docs: note what a flipped part does to a part attachment#254
MasamiYitsuse merged 1 commit into
developfrom
docs/attachment-mirror-caveat

Conversation

@MasamiYitsuse

Copy link
Copy Markdown
Collaborator

Description

docs/{ja,en}/workflow/usage_scripting.md document how SpriteStudioPartAttachment2D copies a part's pose — whole transform when update_position / update_rotation / update_scale are all ON, component-wise otherwise — but not what that means once the player is flipped.

A flipped part's pose is a mirror, and a mirror can only be carried as a negative scale. With update_scale OFF, which is the default, the mirror never reaches the target, and flip_h leaves a 180-degree difference in orientation on top of that while flip_v does not. Transform2D decomposes a mirror into a rotation plus a negative scale with the sign on the Y axis, so a horizontal mirror needs an extra half turn to fit that form and the rotation is what keeps it. Anyone attaching a muzzle or a hitbox to a character that turns around hits this on the default settings.

The note also records that get_part_transform() itself stays exact when flipped, provided get_rotation() and get_scale() are read as a pair. That is worth stating explicitly because the Unity player documents the opposite for its own API — Matrix4x4.rotation is undefined on a mirrored matrix, since a quaternion cannot represent a reflection at all. Godot's Transform2D can, so the same question has opposite answers in the two players.

Verified against the engine rather than reasoned about: with a part at 30 degrees, flip_h reports get_rotation() == 150, flip_v reports -30, both with get_scale() == (1, -1), and rotation + scale reconstruct the transform exactly in every case. Both flips together return the determinant to +1 — a real half turn, not a mirror.

Documentation only. No code change, and the SDK submodule pin is untouched.

Merge order against #253 does not matter: that PR touches only ss_player/, this one only docs/, and both branch from the same develop tip.

A flipped part's pose is a mirror, which only a negative scale can carry.
With update_scale OFF — the default — the mirror never reaches the target,
and flip_h leaves a 180-degree difference in orientation on top of that.

Also state that get_part_transform() stays exact when flipped, as long as
rotation and scale are read as a pair.
@MasamiYitsuse
MasamiYitsuse merged commit 37758a4 into develop Aug 2, 2026
@MasamiYitsuse
MasamiYitsuse deleted the docs/attachment-mirror-caveat branch August 2, 2026 16:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant