SDK Question HUD ladder not appearing in VC

JMW

Aspiring Addon Developer
Joined
Aug 5, 2008
Messages
611
Reaction score
52
Points
43
Location
Happy Wherever
Here goes another question that I've been banging over for days and can't find anything in "Search" -

Can't get the vertical HUD ladder to appear in my VC.:
The generic Speed and Height boxes, and Heading scale appear fine.

Code:
bool ShuttlePB::clbkLoadVC (int id)
{
	
	SetCameraOffset (_V(-1.5,0.81,2.5));//(-0.4,3.57,22//(-0.4,3.59,22)
	//offsetcog.z = (fuel_change - last_fuel_change)*80;
    SetCameraDefaultDirection (_V(0,0,1));

    SetCameraRotationRange (RAD*38, RAD*38, RAD*16, RAD*20);
	
	static VCHUDSPEC hud_pilot  = {2, 65,{-1.597596,  0.6337, 1.223131},0.95};//0,0.13,4.44}//-1.5,0.81,0.7395335//0.0226576,  0.6163939, 1.074667
										//-1.560768,  0.5958307, 1.284044//-1.612795  .6564528 1.065958
			
		static VCMFDSPEC mfds_left = {2, 56};//{13, 6}
		static VCMFDSPEC mfds_right= {2, 63};//{12, 6}
		static VCMFDSPEC mfds_user1 = {2, 45};
		
        oapiVCRegisterMFD (MFD_LEFT, &mfds_left);
        oapiVCRegisterMFD (MFD_RIGHT, &mfds_right);
        oapiVCRegisterMFD (MFD_USER1, &mfds_user1);

		oapiVCRegisterHUD (&hud_pilot);
...................................

	return 1;

}
I thought it was a scaling problem but as can be seen, have tried various VCHUDSPEC hud_pilot settings.

This is an "info HUD" (in case it's interfering - don't see why it should)
Code:
bool ShuttlePB::clbkDrawHUD (int mode, const HUDPAINTSPEC *hps, oapi::Sketchpad *skp)
{
	if (oapiCockpitMode() != COCKPIT_VIRTUAL) return false;
		//if (oapiCockpitMode() == COCKPIT_VIRTUAL)
	
	// draw the default HUD
	VESSEL3::clbkDrawHUD (mode, hps, skp);
	int cx = hps->CX, cy = hps->CY;

		if (oapiGetHUDMode() == HUD_SURFACE)
	//if (oapiCockpitMode() == COCKPIT_VIRTUAL)
	{
            int linespacing = 2, charwidth = 2, lineNo = 200, len;
           
            char buffer[256];
            memset(buffer, 0, sizeof(buffer));

            double TASkts = GetAirspeed()*1.94384449;
            double ALTft = (GetAltitude()-2.44)*3.2808399;
			double trim = GetControlSurfaceLevel (AIRCTRL_ELEVATORTRIM);
			double hover = exproc*100;
			double thrust = (GetThrusterLevel(th_main)+ (GetThrusterLevel(th_after)/2))*100;
			
			{if(GetNavmodeState(i))
			skp->Text(5, 241, "HOLDALT", 7);}

			len = sprintf_s(buffer, "KTS %.0f", TASkts);
            skp->Text(0, 128, buffer,  len);

            len = sprintf_s(buffer, "FT %.0f", ALTft);
            skp->Text(194, 128, buffer,  len);

			len = sprintf_s(buffer, "TRIM %.4f", trim);
            skp->Text(5, 230, buffer,  len);
			
		  //  len = sprintf_s(buffer, "FLAPS %.2f", flaps);
          //  skp->Text(185, 230, buffer,  len);
			
			len = sprintf_s(buffer, "THRUST %.1f", thrust);
            skp->Text(178, 241, buffer,  len);

			VECTOR3 v;
			if (GetHorizonAirspeedVector (v)); 
			double vspdwn = (v.y );

			{if(!GetNavmodeState(i))
			len = sprintf_s(buffer, "VERTSPD %.f",vspdwn*196.85);
			skp->Text(5, 241, buffer,  len);}

			//if(GetAltitude() < 100  && gear_proc == 0 && vspdwn <= -9.5 )
			//{
			//{	damage = 1;}
			//if (damage == 1)
			//{skp->Text(52, 190, "WARNING !! GEAR DAMAGE", 22);}
			
			if (GetAltitude() >= 18400)
			{skp->Text(46, 190, "WARNING !! HEIGHT CEILING", 25);}
			
			if (GetAirspeed() >= 725)
			{skp->Text(47, 209, "WARNING !! MAXIMUM SPEED", 24);}
			//}
			//else
			//	if (damage == 0)//damage = 0;
			//{skp->Text(52, 190, "          ", 10);}
			            
			if(GetAltitude() < 350  && gear_proc > 0 && vspdwn <= -0.051 )
			{skp->Text(52, 190, "WARNING!! GEAR NOT DOWN", 23);}
			
    }

	// show gear deployment status
	if (oapiCockpitMode() == COCKPIT_VIRTUAL)
	if (gear_proc == 0)
	{
		int d = hps->Markersize/2;
		if (cx >= -d*3 && cx < hps->W+d*3 && cy >= d && cy < hps->H+d*5) {
		skp->Rectangle (cx-d/2, cy-d*5, cx+d/2, cy-d*4);
		skp->Rectangle (cx-d*3, cy-d*2, cx-d*2, cy-d);
		skp->	Rectangle (cx+d*2, cy-d*2, cx+d*3, cy-d);
		}
	}
return true;
	}

Checked got right mesh index and group:
Code:
MATERIAL 0
TEXTURE 0
NONORMAL
FLAG               2
GEOM 4 2 ;Group 65  
-.9171216 -4.334241E-02  1.282941  1  1
-.9171216  1.212481  1.283651  1  0
-2.183591 -4.334241E-02  1.282941  0  1
-2.183591  1.212481  1.283651  0  0
 2  3  0
 3  1  0

These settings work fine in another project :sos:
Any advice much appreciated.
 
Last edited:

Moach

Crazy dude with a rocket
Addon Developer
Joined
Aug 6, 2008
Messages
1,581
Reaction score
62
Points
63
Location
Vancouver, BC
make sure when registering the hud, you set the "size" parameter to precisely the physical size of the HUD plane square (which apparently you did), as well as the hudCenter vector being all lined up with the center of it...

if not, it won't know how to project the lines, then they'll either move at a different speed from what you see outside, or may look distorted and possibly not be visible at all :rolleyes:


also, check that your hud-drawing function returns true, if not it assumes you're dismissing it or something to that end....


any good? :cheers:
 

JMW

Aspiring Addon Developer
Joined
Aug 5, 2008
Messages
611
Reaction score
52
Points
43
Location
Happy Wherever
Thanks Moach (sorry for big delay getting back:hello:)
Yeah, I think I've just about exhausted all the possibilities I can think of here.
I've duplicated everything I can between the two projects involved, and still get the prob as per attached pics.:shrug:

I need some BIG help to get this one sorted !!:hailprobe:

I'm hoping someone seeing the output will say - "YES!! That's what I had an I cured by ............ "
Using the same vectors for VCHUDSPEC, and same HUD size for both:
Notice we get no vertical ladder, a BIG cross-hairs off-centre height-wise and moved right of centre, whereas correct version is LEFT of centre and fine. ???????

Also, the horizon lines ( _^_ ) don't move as they should relative to the cross-hairs - seems to go up when should go down, an vice-versa.:facepalm:

Please save me from impending insanity or divorce or both !!:beathead:
 
Last edited:
Top