HyperEdit icon indicating copy to clipboard operation
HyperEdit copied to clipboard

Spinning skybox after teleporting to orbit another body

Open Sigma88 opened this issue 9 years ago • 38 comments

I'm having a bug with HyperEdit. I'm pretty sure it's hyperedit since I've been able to reproduce it with a clean KSP 1.0.4 install with only Hyper Edit (not even MM)

to reproduce the bug:

1- from the KSC click on the launch pad and select Kerbal 2 (Stock) then press launch 2- using hyper edit's orbit editor (Simple) set altitude to 1000000 and reference body Duna (works with EVE, Jool too. probably works with every planet. I didn't check them all) 3- after your ship moved time warp, it works with any level of time warp. but higher time warp are worst 4- look at the skybox go crazy

I think this is related to hyperediting a landed ship directly to orbit and maybe even related to this KSP feature

http://bugs.kerbalspaceprogram.com/issues/5234

If you need logs let me know

btw, to fix the bug: 5- turn off time warp 6- quicksave and quickload and the problem is gone

Sigma88 avatar Jul 24 '15 20:07 Sigma88

I am unable to reproduce this, or I am misunderstanding the issue. When I follow the steps given, I do see what appears to be slow rotation of the craft being amplified by the time-warp, but nothing going crazy. I plan to do a fresh download and install and retry.

Ezriilc avatar Jul 24 '15 20:07 Ezriilc

try maximum time-warp. ships shouldn't rotate in time warp :) I don't know how to make a video, but it's pretty intense. at maximum timewarp the ship is spinning the full 360° more than 1 time each real life second

oh, and thanks for the quick reply :+1:

seems kind of odd nobody has ever noticed this before... (me included)

Sigma88 avatar Jul 24 '15 21:07 Sigma88

it seems that this bug is getting worse now, I think the cause is the fact that KSP uses 2 different frames of reference under 100km the reference frame is tied to the planet's rotation while over 100km it's a fixed reference frame.

this means that when you HE from landed (rotational reference frame) to orbit either kerbin at > 100km or any other planet, the reference frame will still be tied to kerbin's rotation and everything will become wonky

quicksaving and reloading resets the reference frame and fixes the issue

if you manage to solve this, be warned that: 1- jool has a different threshold than other planets (1000 km instead of 100km) 2- Kopernicus can change that threshold for stock and/or custom planets

Sigma88 avatar Apr 30 '16 13:04 Sigma88

Maybe a related issue?

If I try to edit a ship from landed to orbit the craft almost immediately loses its orbit and the vessel is thought to be destroyed. If you switch to Map Mode the orbit lines are gone and after going to the Space Center the vessel is gone.

Reproduction steps, launch Mk1 lander to the pad, edit the craft to be in orbit. The craft should then lose its orbit and "get destroyed". The camera goes a bit funky too. Here's an album of me doing the above: http://imgur.com/a/4y7Ef

If you quicksave immediately after editing the orbit, then reload it all seems to be fine however.

Side note: Not have an issue previously with 1.0 but 1.1 and 1.2 seemed to have induced awareness of this issue to me.

Poodmund avatar Apr 30 '16 13:04 Poodmund

I don't think this particular issue is related. It's very old and should have been closed. However, I think there is something going on now, so I'll leave this open.

Ezriilc avatar Apr 30 '16 14:04 Ezriilc

the issue is still there, are you closing this because you think it would be too complicated to fix?

just asking, no fuss

(I'm talking about the issue I first reported, not pood's)

Sigma88 avatar Jul 14 '16 23:07 Sigma88

No, I just didn't know if it was still there, and I'm not used to working with others in a repo.

Ezriilc avatar Jul 14 '16 23:07 Ezriilc

I'm currently in no position to fix or even chase this bug, but I am slowly learning the API. So, no projected time can be given, sorry.

Ezriilc avatar Jul 14 '16 23:07 Ezriilc

no problem! if you need any help to reproduce the issue let me know.

basically what is going on is: KSP uses 2 different frame of reference. a fixed one and a rotational one.

the fixed one is used in space while the rotational is used near planets.

the altitude threshold where the rotational reference frame kicks in is 100000 meters for most planets, it can be changed with kopernicus, the variable is called inverseRotThresholdAltitude

when you hyperedit from kerbin landed to another planet's orbit, ksp still uses the rotational reference frame linked to kerbin, so the ship flips weirdly.

when you quicksave and quickload, ksp recalculates the reference frame and so the spinning stops

I guess that if you can manage to trigger a reference frame recalculation it would fix this issue.

sadly I have no idea how you would go about doing that :|

I hope this can help you :+1:

Sigma88 avatar Jul 14 '16 23:07 Sigma88

As I'm currently under the hood of HyperEdit and figuring it out, it does actually help - thanks.

Are you sure you're using the latest of both KSP and HyperEdit? Just to be sure.

Ezriilc avatar Jul 14 '16 23:07 Ezriilc

yes, this hyperedit and latest ksp (1.1.3)

Sigma88 avatar Jul 14 '16 23:07 Sigma88

I am still unable to make this happen. I've used Orbit Editor to put me around Mun at 200km and 20km with no undue effects.

Ezriilc avatar Jul 15 '16 00:07 Ezriilc

try duna, or eeloo 250km altitude

-from KSC, click on the tracking station and put on the pad a "Kerbal 2" -while still on the pad, use HyperEdit to go to Eeloo (or Duna) 250 km altitude -put the camera on "locked" -time warp at max speed, you will see the skybox spinning

if you quicksave and quickload, put the camera on lock, and time-warp, you won't see the skybox spinning

of course is not the skybox which is spinning, it's the craft. using locked allowes you to be fixed on the craft so that you can track any movement relative to the skybox

Sigma88 avatar Jul 15 '16 00:07 Sigma88

AHA! Now I get it. Yep, that's wrong. I'll leave this open until I know enough to get it fixed.

Ezriilc avatar Jul 15 '16 00:07 Ezriilc

feel free to ping me any time you may need help. you can also find me on the IRC channel for kopernicus ( #kopernicus on irc.espernet.net)

Sigma88 avatar Jul 15 '16 08:07 Sigma88

Now I'm hunting for a property to set to fix this. By simply guessing, I suspect it's in vessel, but not everything is documented. I'm looking here: https://docuwiki-kspapi.rhcloud.com/#/classes/Vessel

Any help with this effort is greatly appreciated.

Ezriilc avatar Jul 15 '16 16:07 Ezriilc

So, I'm doing a test to see the value of FlightGlobals.RefFrameIsRotating, and it's reporting FALSE, but I'm not sure if this is the right thing to be checking.

Ezriilc avatar Jul 15 '16 19:07 Ezriilc

Correction: It reports TRUE at first, then immediately goes to FALSE.

Ezriilc avatar Jul 15 '16 19:07 Ezriilc

I also get FALSE for newOrbit.referenceBody.inverseRotation, which seems related to inverseRotThresholdAltitude.

So, at this point, I'm kinda stumped.

Ezriilc avatar Jul 15 '16 19:07 Ezriilc

I don't really know much about that stuff, I usually ask @nathankell :)

Sigma88 avatar Jul 17 '16 01:07 Sigma88

each frame OrbitPhysicsManager will set the body to inverse rot if you're below the inverse rot threshold, or to non-inverse rot if above. Probably what's happening is it's an off-by-a-frame condition?

NathanKell avatar Jul 17 '16 05:07 NathanKell

NathanKell, thank you for coming in to help! I was going to wait until Monday to bother you.

I'm sorry, but I'm still pretty new at this, and I don't understand "it's an off-by-a-frame condition". Is that something I can check and/or fix in our code?

Ezriilc avatar Jul 17 '16 18:07 Ezriilc

Apparently, this issue isn't unique to HyperEdit, and is being caused by something in KSP/Unity itself. As soon as it is figured out, we'll be notified. I'll wait until then to close this.

Ezriilc avatar Jul 23 '16 16:07 Ezriilc

ok, feel free to close it if you cannot fix it :+1:

Sigma88 avatar Jul 23 '16 22:07 Sigma88

I'm reasonably sure that we'll figure some way to fix or get around it one way or another, eventually.

Ezriilc avatar Jul 23 '16 23:07 Ezriilc

It appears this has been fixed in KSP v1.2 full release. Barring any objections, I will close this issue. @Sigma88?

Ezriilc avatar Oct 14 '16 17:10 Ezriilc

I just tested this and I can confirm the issue is still there sadly.

steps to reproduce remain the same:

1- load ksp with hyperedit 2- put a "Kerbal 2" craft on the pad 3- while controlling the "Kerbal 2", still attached to the clamps, open hyperedit and go to duna 250000 altitude 4- put the camera on "Locked" 5- while timewarping you will see that the ship rotates against the background

Sigma88 avatar Oct 15 '16 21:10 Sigma88

Dang it. I forgot to go to Duna. You're correct, this issue remains. EDIT: Thanks for catching that, @Sigma88

@NathanKell I thought you should know about this.

Ezriilc avatar Oct 16 '16 18:10 Ezriilc

@Ezriilc no problem!

This is a quick description of what I think is causing the bug, to bring up to speed new people that find this issue.

HOW TO REPRODUCE 1- load ksp with hyperedit 2- put a "Kerbal 2" craft on the pad 3- while controlling the "Kerbal 2", still attached to the clamps, open hyperedit and go to duna 250000 altitude 4- put the camera on "Locked" 5- while timewarping you will see that the ship rotates against the background

POSSIBLE CAUSES I believe there is some kind of tag linked to the position of the craft, when you hyperedit from landed to in space this tag is not updated correctly. I believe the issue is also linked to the difference in reference frame KSP uses while close to a planet (<100km) vs far away (>100km) In this particular case, the issue looks like the craft orientation is calculated using Kerbin's reference frame. and since Duna and Kerbin are different it results in the craft seemingly rotating.

The issue goes away if you save-reload. This means the tag is not maintained through saves.

Sigma88 avatar Oct 21 '16 08:10 Sigma88

I can't reproduce this bug so it might be worth closing @Ezriilc ?

fronbow avatar Dec 22 '17 19:12 fronbow