Skip to content

Instantly share code, notes, and snippets.

@fingerboxes
Created September 29, 2016 20:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fingerboxes/b59ea016fcb8c8ab6f99d1d847037b4a to your computer and use it in GitHub Desktop.
Save fingerboxes/b59ea016fcb8c8ab6f99d1d847037b4a to your computer and use it in GitHub Desktop.
Trying to spawn a vessel directly without pitching to flight
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);
}
}
}
@fingerboxes
Copy link
Author

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'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment