Orbiter-Forum  

Go Back   Orbiter-Forum > Orbiter Space Flight Simulator > Orbiter SDK
Register Blogs Orbinauts List Social Groups FAQ Projects Mark Forums Read

Orbiter SDK Orbiter software developers post your questions and answers about the SDK, the API interface, LUA, meshing, etc.

Reply
 
Thread Tools
Old 05-14-2019, 10:45 AM   #1
gattispilot
Addon Developer
 
gattispilot's Avatar
Default Spawning a landed vessel

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
gattispilot is offline   Reply With Quote
Old 05-14-2019, 10:49 AM   #2
Urwumpe
Not funny anymore
 
Urwumpe's Avatar

Default

vs.status = 0;

is the value you might want to review.
Urwumpe is offline   Reply With Quote
Old 05-14-2019, 10:58 AM   #3
gattispilot
Addon Developer
 
gattispilot's Avatar
Default

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)
gattispilot is offline   Reply With Quote
Old 05-14-2019, 12:39 PM   #4
Urwumpe
Not funny anymore
 
Urwumpe's Avatar

Default

Quote:
Originally Posted by gattispilot View Post
 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.
Urwumpe is offline   Reply With Quote
Thanked by:
Old 05-16-2019, 10:52 AM   #5
gattispilot
Addon Developer
 
gattispilot's Avatar
Default

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);
	}
}
gattispilot is offline   Reply With Quote
Old 05-16-2019, 11:36 AM   #6
Urwumpe
Not funny anymore
 
Urwumpe's Avatar

Default

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       |
Urwumpe is offline   Reply With Quote
Old 05-16-2019, 12:12 PM   #7
gattispilot
Addon Developer
 
gattispilot's Avatar
Default

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?
gattispilot is offline   Reply With Quote
Old 05-16-2019, 01:12 PM   #8
Urwumpe
Not funny anymore
 
Urwumpe's Avatar

Default

Quote:
Originally Posted by gattispilot View Post
 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.
Urwumpe is offline   Reply With Quote
Thanked by:
Reply

  Orbiter-Forum > Orbiter Space Flight Simulator > Orbiter SDK


Thread Tools

Posting Rules
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Jump


All times are GMT. The time now is 12:04 AM.

Quick Links Need Help?


About Us | Rules & Guidelines | TOS Policy | Privacy Policy

Orbiter-Forum is hosted at Orbithangar.com
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.
Copyright 2007 - 2017, Orbiter-Forum.com. All rights reserved.