General Question Getting older add-ons to work in 2016

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
10,542
Reaction score
4,372
Points
203
Location
Dallas, TX
So I am trying to get some of my add-ons to work in 2016.

So I re compile using the 2016 SDK.

Not sure how to fix the touchdown points issue. I thought you could do the old 3 points or the newer with springs,....

So like with the airwolf.
Code:
void AIRWOLF2::clbkSetClassCaps (FILEHANDLE cfg)
//void AIRWOLF2::SetTransporter()
{
	// physical specs
	SetSize (8.2);
	SetEmptyMass (6400);//15000.0  2389
	SetCW (0.3, 0.3, 0.6, 0.9);
	SetWingAspect (0.1);
	SetWingEffectiveness (0.1);
	SetCrossSections (_V(29.73,48.13,12.72));
	SetRotDrag (_V(1.5,1.5,1.5));
	if (GetFlightModel() >= 1) {
		SetPitchMomentScale (1e-4);
		SetBankMomentScale (1e-4);
	}
	SetPMI (_V(26.20,22.72,17.06));
	SetTrimScale (0.05);
	SetCameraOffset (_V(.48,-.5,4.7));
	
	SetTouchdownPoints  (_V(0,-2.381,9), _V(-4,-2.381,-9), _V(4,-2.381,-9));; //28
EnableTransponder (true);

 SetMaxWheelbrakeForce(200000);

Code:
th_hover[0] = CreateThruster (_V(0,0,-.003), _V(0,1,0), PB_MAXHOVERTH, hpr, PB_ISP);
		//AddExhaust (th_hover[i], 0.3, 0.5,_V(HoverEngineOfs[i].x,HoverEngineOfs[i].y,HoverEngineOfs[i].z),_V(0,-1,0));
		thg_hover = CreateThrusterGroup (th_hover, 1, THGROUP_HOVER);
qVeqePv.jpg

Start:
26Y5mNv.jpg

applied hover:
fgf3uF7.jpg


So I apply hover and the copter sinks below the surface and flies below the surface.
Another one. The Neb from the Matrix.

Start:
AabPThK.jpg


Same thing apply hover and it goes below the surface

---------- Post added 03-18-18 at 07:39 AM ---------- Previous post was 03-17-18 at 07:41 AM ----------

So I went back and did the touchdown points to the DG and they are better. Still slide off a pad:(

But on the ranger I did the same but the nose is still down. I remember that by increasing the springs it would bring the nose up. But I tripled and nothing:
Code:
static const DWORD ntdvtx_geardown = 3;
static TOUCHDOWNVTX tdvtx_geardown[ntdvtx_geardown] = {
	{ _V(0, -1.31835, 10), 1e24, 1e15, 3.0, 0.2 },
	{ _V(-3.5, -1.31835, -1), 1e6, 1e5, 3.0, 0.2 },
	{ _V(3.5, -1.31835, -1), 1e6, 1e5, 3.0, 0.2 },
};

LnYUDIM.jpg
 
Could it be that the surface itself isn’t flat?
 
Maybe. But the front should be level as the mesh is level.

I think by adjusting the front point higher would do that but then the flight would not be level
 
Gattis, I'm converting Altair and this seems to work.
Altair is a tailsitter, you only have hoover engines. So the points define forward as the main movement direction.

(adapted from the DG code and other stuff posted here)

Code:
// point, stiffness, dampening, isotropic/lateral friction coefficient, longitudinal friction coefficient (only used for first 3 points)
const double weight=vessel_dry_weight+vessel_fuel+vessel_cargo;
const double xtx_target=-0.1;
const double xtst=(-1)*(weight*9.80655)/(3*xtx_target);
const double xtda=0.9*(2*sqrt(weight*xtst));

static const DWORD ntdvtx_geardown = 4;
static TOUCHDOWNVTX tdvtx_geardown[ntdvtx_geardown] = {
	{_V( -4,0,-4), xtst,  xtda, 30.0,30.0},
	{_V(4,0,-4),  xtst,  xtda,  30.0,30.0},
	{_V(4,0,4), xtst,  xtda, 30.0,30.0},
	{_V( -4,0,4), xtst,  xtda,  30.0}
};

Those 30.0 coefficients make the vessel landed, if I use smaller values (3.0) it drifts.
The points are straight from my mesh coordinates and define a square.



Just try some values that make a square around your vessel.
Unless you are driving on the surface, it doesn't matter where the wheels are!

So for you perhaps:
-4, -2.381, -9
4, -2.381, -9
4, -2.381, 9
-4, -2.381, 9



Copy / paste code is never good but I hope this helps.
 
Last edited:
Thanks I will try. And it flys straight? Because I thought the first needed to be 0 on the x axis?
 
Try to see the points as the basis of a pyramid for example.

With four points you get:
Code:
##################
# -4|+9 ## +4|+9 #
##################
# -4|-9 ## +4|-9 #
##################

The four corners of this rectangle will sit on the ground.
Vessel Up or Down will be defined by the + or - values of the corners. So if the vessel is reversed or mirrored, you change the order of the points.
On this case you have a long ship, so one axis is -9 to +9, the other -4 to +4.



With three points:
Code:
##################
###### 0|+9 ######
##################
# -4|-9 ## +4|-9 #
##################

It's the same. If you try to imagine the "pyramid" it will point the same way.

But 4 points seems to balance better and be more stable.
Specially if the ground is sloped and you want the ship to stop when landed.
 
Last edited:
Thanks. Seem to work for the Ranger. I think for Ground vessels Fred's Ground vessel maybe the way to go.

So how have you done with touchdown points with gear going up?

It looked like the DG and if gear up this touchdown and if gear down this touchdown. Shuttle A has moveable touchdown
 
Altair's gear is animation only :) It was like that on 2010, only one set of landing points.

Don't know what you are trying to do, but the DG points are different.
The DG has wheels and must accelerate and turn on the ground.
 
Thanks. worked great.

So on the Ranger which has Landing gear that retract up into the body
Code:
const double weight = EMPTY_MASS + FUELMASS2 + FUELMASS3 + FUELMASS1;
const double xtx_target = -0.1;
const double xtst = (-1)*(weight*9.80655) / (3 * xtx_target);
const double xtda = 0.9*(2 * sqrt(weight*xtst));

static const DWORD ntdvtx_geardown = 4;
static TOUCHDOWNVTX tdvtx_geardown[ntdvtx_geardown] = {
	{ _V(-4, -1.31835, -4), xtst, xtda, 30.0, 30.0 },
	{ _V(4, -1.31835, -4), xtst, xtda, 30.0, 30.0 },
	{ _V(4, -1.31835, 4), xtst, xtda, 30.0, 30.0 },
	{ _V(-4, -1.31835, 4), xtst, xtda, 30.0 }
};


So the old code was this:
Code:
	if (value == 0)
		SetTouchdownPoints(_V(0, -1.31835, 0.16), _V(-0.1496, -1.31835, -7.854), _V(0.1496, -1.31835, -7.854));
	else {
		double height_back = -1 * (1.31835 - 0.6171) * (value <= 0.5 ? 1.0 - value * 2 : 0.0);
		double height_front = -1 * (1.31835 - 0.5049) * (1.0 - value);
		SetTouchdownPoints(_V(0, -0.5049 + height_front, 1.33705), _V(-1.09395, -0.6171 + height_back, -5.984), _V(1.09395, -0.6171 + height_back, -5.984));
	}
	SetAnimation(anim_GEAR, value);
	GEAR_proc = value;


The dg looked like it had 2 states gear up/down and depending on which state use the touchdown points.

But the shuttle a
Code:
static const int ntdvtx = 16;
static TOUCHDOWNVTX tdvtx[ntdvtx] = {
	{_V(-3  ,-3.05, 12.5), 3.5e6, 3.5e5, 3},
	{_V(-3  ,-3.05,-13.5), 3e6,   3e5,   3},
	{_V( 3  ,-3.05,-13.5), 3e6,   3e5,   3},
	{_V( 3  ,-3.05, 12.5), 3.5e6, 3.5e5, 3},
	{_V(-7.7, 0   ,-0.4 ), 3e7,   3e6,   3},
	{_V( 7.7, 0   ,-0.4 ), 3e7,   3e6,   3},
	{_V(-1.5, 3   ,13.5 ), 3e7,   3e6,   3},
	{_V( 1.5, 3   ,13.5 ), 3e7,   3e6,   3},
	{_V(-1.3, 2.8 ,17   ), 3e7,   3e6,   3},
	{_V( 1.3, 2.8 ,17   ), 3e7,   3e6,   3},
	{_V(-1.8, 0   ,18.3 ), 3e7,   3e6,   3},
	{_V( 1.8, 0   ,18.3 ), 3e7,   3e6,   3},
	{_V(-1.9, 2.2 ,-13.8), 3e7,   3e6,   3},
	{_V( 1.9, 2.2 ,-13.8), 3e7,   3e6,   3},
	{_V(-3.3, 0   ,-14.9), 3e7,   3e6,   3},
	{_V( 3.3, 0   ,-14.9), 3e7,   3e6,   3}
};

Code:
	TOUCHDOWNVTX tdv[ntdvtx];
	memcpy(tdv, tdvtx, ntdvtx*sizeof(TOUCHDOWNVTX));
	for (int i = 0; i < ntdvtx; i++)
		tdv[i].pos.y += gear_proc*0.555;
	SetTouchdownPoints (tdv, ntdvtx);

So the Y value changed with the gear proc

---------- Post added at 07:15 PM ---------- Previous post was at 05:17 AM ----------

This I think will work :
Code:
void RANGER::UpdateGearProc(double const value) {
	if (value == 0) SetTouchdownPoints(tdvtx_geardown, ntdvtx_geardown);
	else  {
		TOUCHDOWNVTX tdv[ntdvtx_geardown];
		memcpy(tdv, tdvtx_geardown, ntdvtx_geardown*sizeof(TOUCHDOWNVTX));
		double height_back = -1 * (1.31835 - 0.6171) * (value <= 0.5 ? 1.0 - value * 2 : 0.0);
		double height_front = -1 * (1.31835 - 0.5049) * (1.0 - value);
		tdv[0].pos.y = height_front;
		tdv[1].pos.y = height_front;
		tdv[2].pos.y = height_back;
		tdv[3].pos.y = height_back;
		SetTouchdownPoints(tdv, ntdvtx_geardown);
	}
	SetAnimation(anim_GEAR, value);
	GEAR_proc = value;
 
tdv.pos.y += animation_step*amplitude_of_change;

The Y component of the landing points will change according to the animation steps.
Of course animation step will be from 0 to 1, and the amplitude of change will translate it to meters.

Only testing will tell, but the code seems to do what you want.
 
So I am trying to get the LER to work without General vehicle.

Code:
const double weight = MASS + FUELMASS;
const double xtx_target = -0.1;
const double xtst = (-1)*(weight*9.80655) / (3 * xtx_target);
const double xtda = 0.9*(2 * sqrt(weight*xtst));

static const DWORD ntdvtx_geardown = 4;
static TOUCHDOWNVTX tdvtx_geardown[ntdvtx_geardown] = {
	{ _V(-4, -2.162, -4), xtst, xtda, 30.0, 30.0 },
	{ _V(4, -2.162, -4), xtst, xtda, 30.0, 30.0 },
	{ _V(4, -2.162, 4), xtst, xtda, 30.0, 30.0 },
	{ _V(-4, -2.162, 4), xtst, xtda, 30.0 }
};

this was the touchdown:
//SetTouchdownPoints(_V(0, -2.162, -0.05774), _V(0.05, -2.162, -0.02887), _V(-0.05, -2.162, -0.02887));

SetTouchdownPoints(tdvtx_geardown, ntdvtx_geardown);


const double MASS = 4000;
const double FUELMASS = 10; But The LER is upside down and spins around the ground
 
So I tried 3 points. The vessel when placed on a base is ok. But then it rotates and finally ends below the surface.
Code:
const double weight = MASS + FUELMASS;
const double xtx_target = -0.1;
const double xtst = (-1)*(weight*9.80655) / (3 * xtx_target);
const double xtda = 0.9*(2 * sqrt(weight*xtst));

static const DWORD ntdvtx_geardown = 3;
static TOUCHDOWNVTX tdvtx_geardown[ntdvtx_geardown] = {
	{ _V(0, -2.166, -4), xtst, xtda, 30.0, 30.0 },
	{ _V(-4, -2.166, -4), xtst, xtda, 30.0, 30.0 },
	{ _V(4, -2.166, -4), xtst, xtda, 30.0, 30.0 },
	
};

PGyzU50.jpg


I tried Fred's Hack and it set good for didn't move.
0RCRUcp.jpg
 
In Orbiter 2016 you have to define touchdown points for the hull as well, because only the touchdown points impact the ground. Unlike Orbiter 2010, Orbiter 2016 by design does not magically auto-right vessels when they touch down. You can take a look at the default DeltaGlider sample sources to see how to do it.
 
Thanks. I thought those other values was for collision detection? So it needs those other values to tell Orbiter which way is up in the vessel?

---------- Post added 04-01-18 at 08:15 AM ---------- Previous post was 03-31-18 at 11:43 AM ----------

So I did this. So when I start the scn The vessel starts to rotate and end upside down.

Code:
const double weight = MASS + FUELMASS;
const double xtx_target = -0.1;
const double xtst = (-1)*(weight*9.80655) / (3 * xtx_target);
const double xtda = 0.9*(2 * sqrt(weight*xtst));

static const DWORD ntdvtx_geardown = 13;
static TOUCHDOWNVTX tdvtx_geardown[ntdvtx_geardown] = {
	{ _V(0, -2.166, -4), xtst, xtda, 30.0, 30.0 },
	{ _V(-4, -2.166, -4), xtst, xtda, 30.0, 30.0 },
	{ _V(4, -2.166, -4), xtst, xtda, 30.0, 30.0 },
	{ _V(-2, -2.166, -3), 1e7, xtda, 3.0 },
	{ _V(2, -2.166, -3), 1e7, xtda, 3.0 },
	{ _V(-2, -2.166, 3), 1e7, xtda, 3.0 },
	{ _V(2, -2.166, 3), 1e7, xtda, 3.0 },
	{ _V(-2, 2.3, -3), xtda, 1e5, 3.0 },
	{ _V(2, 2.3, -3), xtda, 1e5, 3.0 },
	{ _V(-2, 2.3, -3), xtda, 1e5, 3.0 },
	{ _V(2, 2.3, -3), xtda, 1e5, 3.0 },
	{ _V(0, 2, 6.2), 1e7, xtda, 3.0 },
	{ _V(0, -0.6, 10.65), xtda, 1e5, 3.0 }
};

Shouldn't this be landed?
LER:LER5
STATUS Orbiting Moon
RPOS 1161955.088 1169797.589 -541422.585
RVEL 1.6629 -0.3958 2.7661
AROT 44.697 19.778 -135.534
VROT 0.4652 3.4299 -0.0138
RCSMODE 0
AFCMODE 7
PRPLEVEL 0:1.000000
IDS 0:560 100 1:564 100
NAVFREQ 0 0
WHEELROT 0.000000
END

---------- Post added 04-02-18 at 07:50 AM ---------- Previous post was 04-01-18 at 08:15 AM ----------

Well I went back to the old 3 point Touchdown and the same effect.
I am not sure why it says orbiting versus Landed. I know Fred18 did a hack for this. I can redo the movement code to fit that. But the LEr would only work on the Moon.

---------- Post added at 07:37 PM ---------- Previous post was at 07:50 AM ----------

I went back and used DG touchdown points same issue the vessel is upside down. I used Fred's td from General Vessel and the sam upside vessel.

Code:
	double ro = Passo;
	TOUCHDOWNVTX td[4];
	double Height_From_Ground = -2.14;
	double x_target = -0.5;
	double stiffness = (-1)*(EmptyMass*9.80655) / (3 * x_target);
	double damping = 0.9*(2 * sqrt(EmptyMass*stiffness));
	for (int i = 0; i<4; i++)
	{

		td[i].damping = damping;
		td[i].mu = 3;
		td[i].mu_lng = 3;
		td[i].stiffness = stiffness;
	}
	td[0].pos.x = cos(30 * RAD)*ro;
	td[0].pos.y = -Height_From_Ground;
	td[0].pos.z = -sin(30 * RAD)*ro;
	td[1].pos.x = 0;
	td[1].pos.y = -Height_From_Ground;
	td[1].pos.z = 1 * ro;
	td[2].pos.x = -cos(30 * RAD)*ro;
	td[2].pos.y = -Height_From_Ground;
	td[2].pos.z = -sin(30 * RAD)*ro;
	td[3].pos.x = 0;
	td[3].pos.y = 15 * ro;
	td[3].pos.z = 0;


	SetTouchdownPoints(td, 4);

Why Orbiting?
STATUS Orbiting Moon

---------- Post added 04-03-18 at 05:41 AM ---------- Previous post was 04-02-18 at 07:37 PM ----------

Well I removed all the thrust setting and that was it. She sits upright. So just to get her to move.
 
Back
Top