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

Compress Parts (Rotate) leads to RUD at high angles #46

Open
fat-lobyte opened this issue Mar 16, 2017 · 3 comments
Open

Compress Parts (Rotate) leads to RUD at high angles #46

fat-lobyte opened this issue Mar 16, 2017 · 3 comments

Comments

@fat-lobyte
Copy link

If Konstruction ports are docked at a high roll angle (the black rectanble is on opposite sides), clicking "Compress Parts (Rotate)" will cause the craft to disassemble and send parts spinning at high velocities.

This happens 100% of the times at high angles (like 180°), but the lower the angle, the more random it gets and the lower the probability of it happening.

For reproduction,

  1. load the following save file: konstruction-rotate-parts-disassembly.sfs.txt
  2. Right-Click on one Port, click "Reset Acquire". The ports should dock now automatically
  3. Click Compress Parts (Rotate)
@ghost
Copy link

ghost commented Jun 14, 2018

And it does not respect the angle setting. It happens to me sometimes, that I accidentaly place one dock rotated 180°. It would be nice if either
a) respected the angle setting on the port (which you can set to 180° for snap) or
b) never rotated more than 180° (angleNeeded % 180 ... modulo, or maybe 90°) to prevent the explosion alltogether while still fixing small errors.

I have looked at the code, it seems to be here: https://github.com/BobPalmer/Konstruction/blob/master/Source/Konstruction/Konstruction/ModuleWeldablePort.cs

        private Vector3 GetRotation(WeldingData wData)
        {
            var offset = Quaternion.Inverse(wData.DockingPortA.transform.localRotation)
                * wData.DockingPortB.transform.localRotation;
            var oAngle = offset.eulerAngles;           
            //Add a 180 x-flip.
            return new Vector3(oAngle.x, oAngle.y, CorrectAngle(oAngle.z - 180));
}

But I don't know how to fix it, which angle is which, don't know KSP API / Unity.

@fat-lobyte
Copy link
Author

@firda-cze There is a certain chance that the Angle Snap doesn't do what you think it does. It certainly didn't do what I expected it to do, until I experimented with it. Here's how it's mean to work:
https://github.com/UmbraSpaceIndustries/MKS/wiki/Functions-(Konstruction)#angle-snap

@ghost
Copy link

ghost commented Jun 15, 2018

For example, if the Angle is set to 180, there are only 2 allowed positions: 0° and 180°.

I think I know perfectly how it works or should work. It should be the parameter to the modulo (if non-zero) and Compress-Rotate should never rotate more than half of this (choose the angle closest to zero).

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

No branches or pull requests

1 participant