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

Scaled robotic parts propagate their scale onto child parts in the editor #48

Closed
gotmachine opened this issue Jun 27, 2022 · 0 comments
Closed
Labels
kspBug Identified KSP issue kspModding Modding fix or API extension

Comments

@gotmachine
Copy link
Contributor

gotmachine commented Jun 27, 2022

Reproduction steps :

  1. Add this MM patch :
@PART[hinge_01]
{
	@rescaleFactor = 2
}
  1. Launch the game, go to the VAB
  2. Place a "G11 Hinge"
  3. Attach any part to it
  4. Move the hinge target angle in the PAW

This results in the child part(s) suddenly being scaled 200%.
This is an editor-only, mainly cosmetic issue, but quite annoying nevertheless.

Cause

This happen because when moving a servo part in the editor, this re-parent the child part(s) to the servo "moving" object, which is inside the servo part model hierarchy.
Meaning if the servo part model is scaled 2x, the child now needs to be scaled 0.5x to keep it's original scale.

But the KSP code explicitly force the scale to 1x after reparenting (I guess because the parts root transform scale isn't supposed to be anything other than 1x).

See BaseServo.SetChildParentTransform().

Fix

Removing the "force scale to 1x" bit on re-parenting seems to work with no immediate side effect, allowing non-1x scale robotic parts to be manipulated in the editor. I guess this works correctly because KSP used to mess around with scale for mirror symmetry, so there is some "revert back to identity scale on part disconnect" code lying around.

It does introduce a breaking change to an unspoken stock convention. But I wouldn't expect anything to rely on parts root transform scale being always 1x, especially in the editor (famous last words).

@gotmachine gotmachine added kspBug Identified KSP issue kspModding Modding fix or API extension labels Jun 27, 2022
gotmachine added a commit that referenced this issue Jun 29, 2022
…their scale to child parts in the editor (issue #48).

Version bump to 1.18
gotmachine added a commit that referenced this issue Jan 30, 2023
…their scale to child parts in the editor (issue #48).

Version bump to 1.18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kspBug Identified KSP issue kspModding Modding fix or API extension
Development

No branches or pull requests

1 participant