Advanced Question Spawning a landed vessel

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,693
Reaction score
2,671
Points
203
Location
Dallas, TX
So I am trying to spawn a landed EVA guy aka vessel. In the shuttle the vessel is made a docked. But I want a vessel made and placed on the ground upright like UMMU.


Code:
void LER2016::SeparateMMU(void)
{
    if (DOOR0_proc > .8){

        OBJHANDLE EVAGUY;
        VESSELSTATUS2 vs;
        vs.version = 2;
        vs.flag = 0;
        GetStatusEx(&vs);
        VECTOR3 ofs = _V(-1.5, -2, -1.5);
        VECTOR3 rofs, rvel = { vs.rvel.x, vs.rvel.y, vs.rvel.z };
        VECTOR3 vel = { 0, 0, 0 };
        Local2Rel(ofs, vs.rpos);
        GlobalRot(vel, rofs);
        vs.rvel.x = rvel.x + rofs.x;
        vs.rvel.y = rvel.y + rofs.y;
        vs.rvel.z = rvel.z + rofs.z;
        vs.vrot.x = 0.00;
        vs.status = 0;




        VESSEL *EVAGUY_vessel;
        EVAGUY = oapiCreateVesselEx("EVAGUY", "evaguy2016", &vs);
        EVAGUY = oapiGetVesselInterface(EVAGUY);
    }
}
So if the door is open make a vessel


Code:
VECTOR3 ofs = _V(-1.5, -2, -1.5);
this is where to put the vessel, right


But it makes the vessel but the vessel is not landed but orbiting. on the ground shaking about
 

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,605
Reaction score
2,327
Points
203
Location
Wolfsburg
Preferred Pronouns
Sire
vs.status = 0;

is the value you might want to review.
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,693
Reaction score
2,671
Points
203
Location
Dallas, TX
Oh. maybe it needs to be 1?
Code:
17.61.2.2 int VESSELSTATUS::status
flight status indicator
Note
• 0=active (freeflight)
• 1=inactive (landed)
 

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,605
Reaction score
2,327
Points
203
Location
Wolfsburg
Preferred Pronouns
Sire
Oh. maybe it needs to be 1?
Code:
17.61.2.2 int VESSELSTATUS::status
flight status indicator
Note
• 0=active (freeflight)
• 1=inactive (landed)

Review VESSELSTATUS2 there - since you are using version=2.
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,693
Reaction score
2,671
Points
203
Location
Dallas, TX
Thanks. But it puts the guy in the center rather than the offset?
Code:
void LER2016::SeparateMMU(void)
{
	if (DOOR0_proc > .8){

		OBJHANDLE EVAGUY;
		VESSELSTATUS2 vs;
		vs.version = 2;
		vs.flag = 0;
		GetStatusEx(&vs);
		VECTOR3 ofs = _V(10.5, -2, -1.5);
		VECTOR3 rofs, rvel = { vs.rvel.x, vs.rvel.y, vs.rvel.z };
		VECTOR3 vel = { 0, 0, 0 };
		Local2Rel(ofs, vs.rpos);
		GlobalRot(vel, rofs);
		vs.rvel.x = rvel.x + rofs.x;
		vs.rvel.y = rvel.y + rofs.y;
		vs.rvel.z = rvel.z + rofs.z;
		vs.vrot.x = 0.00;
		vs.status = 1;




		VESSEL *EVAGUY_vessel;
		EVAGUY = oapiCreateVesselEx("EVAGUY", "evaguy2016", &vs);
		EVAGUY = oapiGetVesselInterface(EVAGUY);
	}
}
 

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,605
Reaction score
2,327
Points
203
Location
Wolfsburg
Preferred Pronouns
Sire
Yes, because you are not using the right variables for a landed vessel:

Code:
    double surf_lng;    // longitude of landing position  |
    double surf_lat;    // latitude of landing position   | only used when landed
    double surf_hdg;    // heading of landed vessel       |
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,693
Reaction score
2,671
Points
203
Location
Dallas, TX
Thanks. So I can't use offset?

So can I get the lat and long of the main vessel and use them. Add some to offset it?
 

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,605
Reaction score
2,327
Points
203
Location
Wolfsburg
Preferred Pronouns
Sire
Thanks. So I can't use offset?

So can I get the lat and long of the main vessel and use them. Add some to offset it?

You might need to project the offset into polar coordinates (latitude and longitude are angles measured in radians, after all) and then apply them.

But don't ask me about the simplest way to do this. Getting the offset into north-south and east-west coordinates would already be enough, since the radius is likely much bigger than the offset.
 
Top