Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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

This comment has been minimized.

Copy link
Owner Author

@fingerboxes fingerboxes commented Sep 29, 2016

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