Programming Question need help with payload offsets

Mr Martian

Orbinaut/Addon dev/Donator
Addon Developer
Donator
Joined
Jun 6, 2012
Messages
317
Reaction score
122
Points
43
Location
Sydney, Australia, Earth, Sol
Website
www.orbithangar.com
hey guys, i am trying to code a vessel that spawns a payload. i have got everything working except for the direction that the spawned vessel is facing. i want the spawned vessel to be pitched down 90 degrees, but i just cant do it. so far i have this:

Code:
void EDS::PayloadSeperation ()
{
		if (VesselState == F2SEP) 
	{	VESSELSTATUS vs;
		char name[256];

		VECTOR3 sofs = PAYLOAD_OFFSET;	// Seperation offset			
		VECTOR3	sdir = { 0.0, 0.0, 1.0};		// Seperation direction
		VECTOR3 srot = {1,0,0};
		MATRIX3 vrot = {0,90,90};
		double	svel = 0.3;				// Separation velocity
				// Get vessel status structure
		VECTOR3 rofs = {90,90,0};
		GetStatus (vs);
		Local2Rel (sofs, vs.rpos);	
		GlobalRot (sdir, rofs);
		HorizonRot (srot, sdir);
		SetRotationMatrix (vrot);
		vs.rvel += rofs*svel;
				// Create descent stage as seperate vessel

		strcpy (name, GetName()); 
		strcat (name, "LM");
		oapiCreateVessel (name, "CONSTELLATION/LM/Altair_LM", vs);	// create descent stage vessel
				// Remove descent stage from vessel instance
		DelMesh (Mesh_Payload);							// Delete descent stage mesh
		VesselState = (PAYLOADSEP);


}
}

i have used the "SetRotationMatrix" function, but it changes the direction of my original vessel, not the spawned one :( any help would be really appreciated...

thanks in advance

---------- Post added at 05:58 AM ---------- Previous post was at 05:38 AM ----------

never mind i think i got it :)
 
Top