Created
September 29, 2016 20:04
-
-
Save fingerboxes/b59ea016fcb8c8ab6f99d1d847037b4a to your computer and use it in GitHub Desktop.
Trying to spawn a vessel directly without pitching to flight
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace SomeAssemblyRequired | |
{ | |
[KSPAddon(KSPAddon.Startup.EditorAny, true)] | |
public class EditorModule : MonoBehaviour | |
{ | |
void Start() | |
{ | |
EditorLogic.fetch.launchBtn.onClick.RemoveAllListeners(); | |
EditorLogic.fetch.launchBtn.onClick.AddListener(delegate { OnLaunchClick(); }); | |
} | |
public void OnLaunchClick() | |
{ | |
ShipConstruct ship = EditorLogic.fetch.ship; | |
SomeAssemblyRequired.Instance.savedShip = ship.SaveShip(); | |
string LaunchSiteName = "LaunchPad"; | |
PSystemSetup.SpaceCenterFacility spaceCenterFacility = PSystemSetup.Instance.GetSpaceCenterFacility(LaunchSiteName); | |
PSystemSetup.SpaceCenterFacility.SpawnPoint spawnPoint = spaceCenterFacility.GetSpawnPoint(LaunchSiteName); | |
Transform spawnPointTransform = spawnPoint.GetSpawnPointTransform(); | |
ShipConstruction.PutShipToGround(ship, spawnPointTransform); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Unable to find the transform... Does it only exist in flight scene?
[PSystemSetup::SpaceCenterFacility::SpawnPoint]: Cannot find a transform named 'Facility/LaunchPad_spawn' on 'LaunchPad'