Skip to content

Geoposition terrainheight is wrong for LATLNG's that are very close to a rover scanner arm #2899

@Dunbaratu

Description

@Dunbaratu

I swear I thought this bug was already reported, but as I look through the issues, I can't seem to find it, so I'm reporting it anew.

To reproduce the problem:

  1. Place a rover scanner arm on a vessel and launch it to the scene, by which I mean one of these three parts from the Breaking Ground DLC: https://wiki.kerbalspaceprogram.com/wiki/CRSY_Light_Scanning_Arm, https://wiki.kerbalspaceprogram.com/wiki/SPRT_Medium_Scanning_Arm, https://wiki.kerbalspaceprogram.com/wiki/OP-E_Large_Scanning_Arm
  2. Ask kOS to tell you what the ship:geoposition:position vector is. Use a vecdraw to visualize it.
  3. Notice the position is NOT the terrain under the vessel like it should be. It's weirdly a few meters up in the sky above the vessel. If your vessel did NOT have a scanner arm on it, then the vector would be correct, pointing at the ground just under the rover.

The cause, I think:

The reason for this happening is something I consider KSP's fault more than kOS's fault, but we may be able to find a means to work around it in the kOS code.

The rover scanner arm parts appear to contain an invisible large spherical collider around them for some reason, and for some reason this collider is on layer 15, which is normally used by KSP for terrain. This sphere appears to be the exact same size and shape as the green "preview range" sphere you can see in the VAB for these scanner arm parts when you rightclick them.

GeoCoordinate.GetTerrainAltitude() uses a raycast to "find" the real terrain hit for LATLNG's near the active vessel where terrain is loaded, and because this weird phantom sphere is on the same layer as the terrain, it's getting seen as a "hit" for the raycast hitting what it thinks is terrain.

Since it seems likely the stock game won't fix this bizzare feature of a phantom collider on the terrain layer that emphatically is Not terrain, we may have to find a way to work around it. (Note, this bug affects stock too, as the phantom collider also blocks solar panels from the sun, but again I don't think it likely that this is getting fixed any time soon.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugWeird outcome is probably not what the mod programmer expected.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions