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

Fix rotation of spawned vessels #44

Merged
merged 1 commit into from
Jul 3, 2024

Conversation

IO5
Copy link

@IO5 IO5 commented Jun 2, 2024

Not sure how this is went unnoticed for so long, but the rotation of landed vessels created via SpawnVessel is completely bogus.
With heading, pitch and roll set to 0 my craft was spawned on the side with a seemingly random heading.

At some point I tried to spawn a vessel with a clamp attached and it turned out to be very nice for debugging. Clamp allowed me to keep the rotation a given vessel was spawned with.

Anyway, (0, 0, 0) heading, pitch and roll before the fix:
image

The main problem, turns out, was the incorrect order of operations: rotation * normal -> normal * rotation. Changing that fixed the (0, 0, 0) case, but for non-zero it was still bogus.

The original code made a distinction between spawned part, the SPH and the VAB, and I'm not sure that's a good thing. Let's say I have a pod in the default orientation in the VAB, in the SPH, or spawned from a single part. If I then specify heading etc as (h, p, r) I expect the navball to point to (h, p, r) when I switch to said pod. I find it more natural than rotating VAB vessels 90 degrees up. On the other hand if we don't do that, then VAB vessels will spawn on their bellies by default.

For now I left the distinction and 90 degrees rotation for the VAB, so it shouldn't negatively affect legacy.

@IO5 IO5 force-pushed the spawn-vessel-rotation-fix branch from 4c5438a to b6c931b Compare June 2, 2024 19:17
@siimav siimav changed the title Fixed rotation of spawned vessels Fix rotation of spawned vessels Jul 2, 2024
@siimav siimav merged commit b433547 into KSP-RO:master Jul 3, 2024
3 checks passed
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.

2 participants