- Joined
- Jun 6, 2012
- Messages
- 330
- Reaction score
- 160
- Points
- 43
- Location
- Sydney, Australia, Earth, Sol
- Website
- www.orbithangar.com
hey guys, i am working on the ISV Pegasus V2.0, and i am having a bit of trouble with the lander separation. i want Pegasus to spawn a lander, which i have managed to do, but i want the spawned vessel to be docked to Pegasus as soon as it is spawned. so far i have this:
as you can see i have used:
but i am not quite sure what i am doing wrong, because orbiter crashes whenever i spawn the lander. any help would be much appreciated
Code:
void Pegasus::OrpheusSep (void)
{
if (OrpheusState == ATTACHED1) // Sanity check, is there a Lander to jettison?
{
VESSELSTATUS vs;
char name[256];
VECTOR3 sofs = ORPHEUS_POS; // Seperation offset
VECTOR3 sdir = { 0, 0, 1}; // Seperation direction
double svel = 0.03; // Separation velocity
// Get vessel status structure
VECTOR3 rofs;
GetStatus (vs);
Local2Rel (sofs, vs.rpos);
HorizonRot (sdir, rofs);
vs.rvel += rofs*svel;
// Create descent stage as seperate vessel
strcpy (name, GetName());
strcat (name, "-Orpheus");
oapiCreateVessel (name, "ISV_PEGASUS/LANDERS/Orpheus", vs); // create descent stage vessel
DelMesh (Mesh_Orpheus);
PlayVesselWave(PEGD,SEPERATION,NOLOOP,900,11025);
Dock (dock_1, 0, 1, 0);
//Dock (OBJHANDLE target, UINT n, UINT tgtn, UINT mode)
OrpheusState = DETACHED1; // Set vessel status to ascent
}
}
as you can see i have used:
Code:
Dock (OBJHANDLE target, UINT n, UINT tgtn, UINT mode)
but i am not quite sure what i am doing wrong, because orbiter crashes whenever i spawn the lander. any help would be much appreciated