Question Ranger (and other ships) from Interstellar?

grid4dante

New member
Joined
Mar 22, 2011
Messages
34
Reaction score
0
Points
0
Location
Midwest City
I had the same thought earlier before I saw your posts. Make the code part of the cargo perpendicular with the mesh rotated 45 degrees, but wouldn't that cause problems with how the cargo looks with the Lander holding it, and also possibly on the ground?
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,690
Reaction score
2,670
Points
203
Location
Dallas, TX
If it worked because the lander uses right angles it would be easy to fix.

Another option would be to make the cargo mesh part of the Endurance. You could move the cargo mesh in and out. BUT then not sure how you could create a new vessel where the fake cargo was?


What is odd. The Arrow seems to be able to attach at odd angles
 

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
If it worked because the lander uses right angles it would be easy to fix.

Another option would be to make the cargo mesh part of the Endurance. You could move the cargo mesh in and out. BUT then not sure how you could create a new vessel where the fake cargo was?


What is odd. The Arrow seems to be able to attach at odd angles

I also can't remember any issues with the angles, as long as the vectors are perpendicular. Maybe you can test it, perpendicular means that the dot product of two vectors is zero (+/- some rounding errors). If you have dotp(DIR, ROT) > 0.0001 you know something is wrong. But this can't happen in the code example above.

Another alternative would be trying to get rid of the ".5" and instead write properly "0.5" everywhere, just like ".866" ...maybe some bug is hiding there.
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,690
Reaction score
2,670
Points
203
Location
Dallas, TX
Code:
	CARGO1 = CreateAttachment(false, _V(0, -20.2, 1.12), _V(0, -1, 0), _V(0, 0, -1), "CARGO1",true);
	CARGO2 = CreateAttachment(false, _V(0, -21.75, 1.12), _V(0, -1, 0), _V(0, 0, -1), "CARGO2", true);
	CARGO3 = CreateAttachment(false, _V(-17.7, -10.15, 1.12), _V(-0.866, -0.5, 0), _V(0, 0, -1), "CARGO3", true);//-17.7 -10.15 1.12  -.866 -.5 0
	CARGO4 = CreateAttachment(false, _V(-19.2, -11.0, 1.12), _V(-0.866, -0.5, 0), _V(0, 0, -1), "CARGO4", true);//-19.2 -11.0 1.12
	CARGO5 = CreateAttachment(false, _V(-20.3, 0, 1.12), _V(-1, 0, 0), _V(0, 0, -1), "CARGO5", true);
	CARGO6 = CreateAttachment(false, _V(-21.8, 0, 1.12), _V(-1, 0, 0), _V(0, 0, -1), "CARGO6", true);
	CARGO7 = CreateAttachment(false, _V(-17.7, 10.15, 1.12), _V(-0.866, 0.5, 0), _V(0, 0, -1), "CARGO7", true);
	CARGO8 = CreateAttachment(false, _V(-19.2, 11.0, 1.12), _V(-0.866, 0.5, 0), _V(0, 0, -1), "CARGO8", true);
	CARGO9 = CreateAttachment(false, _V(0, 20.2, 1.12), _V(0, 1, 0), _V(0, 0, -1), "CARGO9", true);
	CARGO10 = CreateAttachment(false, _V(0, 21.75, 1.12), _V(0, 1, 0), _V(0, 0, -1), "CARGO10", true);
	CARGO11 = CreateAttachment(false, _V(17.7, 10.15, 1.12), _V(0.866, 0.5, 0), _V(0, 0, -1), "CARGO11", true);
	CARGO12 = CreateAttachment(false, _V(19.2, 11.0, 1.12), _V(0.866, 0.5, 0), _V(0, 0, -1), "CARGO12", true);
	CARGO13 = CreateAttachment(false, _V(20.3, 0, 1.12), _V(1, 0, 0), _V(0, 0, -1), "CARGO13", true);
	CARGO14 = CreateAttachment(false, _V(21.8, 0, 1.12), _V(1, 0, 0), _V(0, 0, -1), "CARGO14", true);
	CARGO15 = CreateAttachment(false, _V(17.7, -10.15, 1.12), _V(0.866, -0.5, 0), _V(0, 0, -1), "CARGO15", true);
	CARGO16 = CreateAttachment(false, _V(19.2, -11.0, 1.12), _V(0.866, -0.5, 0), _V(0, 0, -1), "CARGO16", true);

same issue. I wonder if it is due to orientation on the cargo pod.
 

GLS

Well-known member
Orbiter Contributor
Addon Developer
Joined
Mar 22, 2008
Messages
5,914
Reaction score
2,908
Points
188
Website
github.com
Are the meshes twisted, or are my eyes playing tricks on me and the meshes are just being misplaced?
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,690
Reaction score
2,670
Points
203
Location
Dallas, TX
The meshes are not twisted. But it appears they twisted. but only the ones not at right angles
 

GLS

Well-known member
Orbiter Contributor
Addon Developer
Joined
Mar 22, 2008
Messages
5,914
Reaction score
2,908
Points
188
Website
github.com
I just noticed that only the big pods have problems... any difference to the smaller ones?
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,690
Reaction score
2,670
Points
203
Location
Dallas, TX
not sure what you mean? The cargo pods are all the same size. There are 2 slots per pod. 16 slots together.

When the cargo pod is detach the distortion goes away.

So this is what I have. Initial attachments:
Code:
	CARGO1 = CreateAttachment(false, _V(0, -20.2, 1.12), _V(0, -1, 0), _V(0, 0, -1), "CARGO1",true);
	CARGO2 = CreateAttachment(false, _V(0, -21.75, 1.12), _V(0, -1, 0), _V(0, 0, -1), "CARGO2", true);
	CARGO3 = CreateAttachment(false, _V(-17.7, -10.15, 1.12), _V(-.866, -.5, 0), _V(0, -1, 0), "CARGO3", true);//-17.7 -10.15 1.12  -.866 -.5 0
	CARGO4 = CreateAttachment(false, _V(-19.2, -11.0, 1.12), _V(-.866, -.5, 0), _V(0, -1, 0), "CARGO4", true);//-19.2 -11.0 1.12
	CARGO5 = CreateAttachment(false, _V(-20.3, 0, 1.12), _V(-1, 0, 0), _V(0, 0, -1), "CARGO5", true);
	CARGO6 = CreateAttachment(false, _V(-21.8, 0, 1.12), _V(-1, 0, 0), _V(0, 0, -1), "CARGO6", true);
	CARGO7 = CreateAttachment(false, _V(-17.7, 10.15, 1.12), _V(-0.866, 0.5, 0), _V(0, 0, -1), "CARGO7", true);
	CARGO8 = CreateAttachment(false, _V(-19.2, 11.0, 1.12), _V(-0.866, 0.5, 0), _V(0, 0, -1), "CARGO8", true);
	CARGO9 = CreateAttachment(false, _V(0, 20.2, 1.12), _V(0, 1, 0), _V(0, 0, -1), "CARGO9", true);
	CARGO10 = CreateAttachment(false, _V(0, 21.75, 1.12), _V(0, 1, 0), _V(0, 0, -1), "CARGO10", true);
	CARGO11 = CreateAttachment(false, _V(17.7, 10.15, 1.12), _V(0.866, 0.5, 0), _V(0, 0, -1), "CARGO11", true);
	CARGO12 = CreateAttachment(false, _V(19.2, 11.0, 1.12), _V(0.866, 0.5, 0), _V(0, 0, -1), "CARGO12", true);
	CARGO13 = CreateAttachment(false, _V(20.3, 0, 1.12), _V(1, 0, 0), _V(0, 0, -1), "CARGO13", true);
	CARGO14 = CreateAttachment(false, _V(21.8, 0, 1.12), _V(1, 0, 0), _V(0, 0, -1), "CARGO14", true);
	CARGO15 = CreateAttachment(false, _V(17.7, -10.15, 1.12), _V(0.866, -0.5, 0), _V(0, 0, -1), "CARGO15", true);
	CARGO16 = CreateAttachment(false, _V(19.2, -11.0, 1.12), _V(0.866, -0.5, 0), _V(0, 0, -1), "CARGO16", true);

then in the poststep

we move the cargopod attachment out/in.
Code:
	if (PODSel == 1){

		if (CARGO1_status >= RACK_RAISING) {

			double da = simdt * .1;
			if (CARGO1_status == RACK_RAISING) {
				if (CARGO1_proc > 0.0) CARGO1_proc = max(0.0, CARGO1_proc - da);
				else                CARGO1_status = RACK_UP;
			}
			else {
				if (CARGO1_proc < 1.0) CARGO1_proc = min(1.0, CARGO1_proc + da);
				else                CARGO1_status = RACK_DOWN;
			}
			if (CARGO1_status == RACK_UP)SendHudMessage("Rack 1 Retracted");
			if (CARGO1_status == RACK_DOWN)SendHudMessage("Rack 1 Extended");
		}
	}

then move the attachment and beacon
Code:
CARGO1_pos.z = CARGO1_INT_POS - (CARGO1_proc * 5);
	SetAttachmentParams(CARGO1, CARGO1_pos, _V(0, -1, 0), _V(0, 0, -1));
	Cbeaconpos[1].x = CARGO1_pos.x;
	Cbeaconpos[1].y = CARGO1_pos.y;
	Cbeaconpos[1].z = CARGO1_pos.z;
...

CARGO3_pos.z = CARGO3_INT_POS - (CARGO3_proc * 5);
SetAttachmentParams(CARGO3, CARGO3_pos, _V(-0.866, -0.5, 0), _V(0, 0, -1));
Cbeaconpos[3].x = CARGO3_pos.x;
Cbeaconpos[3].y = CARGO3_pos.y;
Cbeaconpos[3].z = CARGO3_pos.z;
[/CODE]

the cfg for the cargo pod is just a mesh and attachment info.
 

GLS

Well-known member
Orbiter Contributor
Addon Developer
Joined
Mar 22, 2008
Messages
5,914
Reaction score
2,908
Points
188
Website
github.com
So the meshes are really being shown with a different shape? Because on the last image you posted it looks like there are "big pods" and "small pods".
Try to just have one attachment for now (one of the problematic ones), without the raise/lower code, and find out if that works and then slowly add more stuff.
 

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
Or you override the SetAttachmentParams function in your vessel, check the inputs there and log the results before delegating it back to the super class.
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,690
Reaction score
2,670
Points
203
Location
Dallas, TX
So the meshes are really being shown with a different shape? Because on the last image you posted it looks like there are "big pods" and "small pods".
Try to just have one attachment for now (one of the problematic ones), without the raise/lower code, and find out if that works and then slowly add more stuff.

ok. The Endurance has 16 slots. the cargo pod is a separate vessel. That is what gets attached to the Endurance.

I have commented the move attachments. I will let you know if a difference.

Or you override the SetAttachmentParams function in your vessel, check the inputs there and log the results before delegating it back to the super class.

not sure what you mean about log the results,....

The whole move attachments is commented out. But basically the attachment point follows the animation.

---------- Post added 07-16-16 at 05:30 AM ---------- Previous post was 07-15-16 at 07:02 AM ----------

Ok. no distortion. :thumbup:

now so the distortion is coming form the movement.

So what we have:

a key selects which pod, then press a key to start the move process. then press a key to detach or press a key to attach.

selects pod and then press 3 to start movement
Code:
else if (key == OAPI_KEY_GRAVE)// SELECT
	{
		PODSel = PODSel + 1;
		if (PODSel == 1)SendHudMessage("Rack 1 Selected");
		if (PODSel == 2)SendHudMessage("Rack 2 Selected");
		if (PODSel == 3)SendHudMessage("Rack 3 Selected");
		if (PODSel == 4)SendHudMessage("Rack 4 Selected");

		if (PODSel == 5)SendHudMessage("Rack 5 Selected");
		if (PODSel == 6)SendHudMessage("Rack 6 Selected");
		if (PODSel == 7)SendHudMessage("Rack 7 Selected");
		if (PODSel == 8)SendHudMessage("Rack 8 Selected");

		if (PODSel == 9)SendHudMessage("Rack 9 Selected");
		if (PODSel == 10)SendHudMessage("Rack 10 Selected");
		if (PODSel == 11)SendHudMessage("Rack 11 Selected");
		if (PODSel == 12)SendHudMessage("Rack 12 Selected");


		if (PODSel == 13)SendHudMessage("Rack 13 Selected");
		if (PODSel == 14)SendHudMessage("Rack 14 Selected");
		if (PODSel == 15)SendHudMessage("Rack 15 Selected");
		if (PODSel == 16)SendHudMessage("Rack 16 Selected");


		if (PODSel > 16) PODSel = 1;
		//turn them all off first



		return 1;
	}


	else if (key == OAPI_KEY_3)
	{
		if (PODSel == 1){
			RevertCARGO1();
			return 1;
		}
		if (PODSel == 2){
			RevertCARGO2();
			return 1;
		}
		if (PODSel == 3){
			RevertCARGO3();
			return 1;
		}
		if (PODSel == 4){
			RevertCARGO4();
			return 1;
		}
		if (PODSel == 5){
			RevertCARGO5();
			return 1;
		}
		if (PODSel == 6){
			RevertCARGO6();
			return 1;
		}
		if (PODSel == 7){
			RevertCARGO7();
			return 1;
		}
		if (PODSel == 8){
			RevertCARGO8();
			return 1;
		}
		if (PODSel == 9){
			RevertCARGO9();
			return 1;
		}
		if (PODSel == 10){
			RevertCARGO10();
			return 1;
		}
		if (PODSel == 11){
			RevertCARGO11();
			return 1;
		}
		if (PODSel == 12){
			RevertCARGO12();
			return 1;
		}
		if (PODSel == 13){
			RevertCARGO13();
			return 1;
		}
		if (PODSel == 14){
			RevertCARGO14();
			return 1;
		}
		if (PODSel == 15){
			RevertCARGO15();
			return 1;
		}
		if (PODSel == 16){
			RevertCARGO16();
			return 1;
		}
		return 1;
	}
then start process to move in/out. the cargo1_proc changes.
this is the same for all 16
Code:
if (PODSel == 1){

		if (CARGO1_status >= RACK_RAISING) {

			double da = simdt * .1;
			if (CARGO1_status == RACK_RAISING) {
				if (CARGO1_proc > 0.0) CARGO1_proc = max(0.0, CARGO1_proc - da);
				else                CARGO1_status = RACK_UP;
			}
			else {
				if (CARGO1_proc < 1.0) CARGO1_proc = min(1.0, CARGO1_proc + da);
				else                CARGO1_status = RACK_DOWN;
			}
			if (CARGO1_status == RACK_UP)SendHudMessage("Rack 1 Retracted");
			if (CARGO1_status == RACK_DOWN)SendHudMessage("Rack 1 Extended");
		}
	}
here is here they move
Code:
	if (PODSel == 16){
		//	SendHudMessage("Rack 16 Selected");
		if (CARGO16_status >= RACK_RAISING) {

			double da = simdt * .1;
			if (CARGO16_status == RACK_RAISING) {
				if (CARGO16_proc > 0.0) CARGO16_proc = max(0.0, CARGO16_proc - da);
				else                CARGO16_status = RACK_UP;
			}
			else {
				if (CARGO16_proc < 1.0) CARGO16_proc = min(1.0, CARGO16_proc + da);
				else                CARGO16_status = RACK_DOWN;
			}
			if (CARGO16_status == RACK_DOWN)SendHudMessage("Rack 16 Extended");
			if (CARGO16_status == RACK_UP)SendHudMessage("Rack 16 Retracted");
		}

	}
	
	CARGO1_pos.z = CARGO1_INT_POS - (CARGO1_proc * 5);
	SetAttachmentParams(CARGO1, CARGO1_pos, _V(0, -1, 0), _V(0, 0, -1));
	Cbeaconpos[1].x = CARGO1_pos.x;
	Cbeaconpos[1].y = CARGO1_pos.y;
	Cbeaconpos[1].z = CARGO1_pos.z;

	CARGO2_pos.z = CARGO2_INT_POS - (CARGO2_proc * 5);
	SetAttachmentParams(CARGO2, CARGO2_pos, _V(0, -1, 0), _V(0, 0, -1));
	Cbeaconpos[2].x = CARGO2_pos.x;
	Cbeaconpos[2].y = CARGO2_pos.y;
	Cbeaconpos[2].z = CARGO2_pos.z;

	CARGO3_pos.z = CARGO3_INT_POS - (CARGO3_proc * 5);
	SetAttachmentParams(CARGO3, CARGO3_pos, _V(-0.866, -0.5, 0), _V(0, 0, -1));
	Cbeaconpos[3].x = CARGO3_pos.x;
	Cbeaconpos[3].y = CARGO3_pos.y;
	Cbeaconpos[3].z = CARGO3_pos.z;

	CARGO4_pos.z = CARGO4_INT_POS - (CARGO4_proc * 5);
	SetAttachmentParams(CARGO4, CARGO4_pos, _V(-0.866, -0.5, 0), _V(0, 0, -1));
	Cbeaconpos[4].x = CARGO4_pos.x;
	Cbeaconpos[4].y = CARGO4_pos.y;
	Cbeaconpos[4].z = CARGO4_pos.z;

I did find that you can't just select the pod and press 3 and go to another pod before the process has finished.

---------- Post added at 11:31 AM ---------- Previous post was at 05:30 AM ----------

For some reason Cargo 16 seems to cause the distortion. If I comment the SetAttachments for CArgo 16 no distortion
 

GLS

Well-known member
Orbiter Contributor
Addon Developer
Joined
Mar 22, 2008
Messages
5,914
Reaction score
2,908
Points
188
Website
github.com
Code:
CARGO1_pos.z = CARGO1_INT_POS - (CARGO1_proc * 5);
	SetAttachmentParams(CARGO[COLOR="Red"]1[/COLOR], CARGO1_pos, _V(0, -1, 0), _V(0, 0, -1));
	Cbeaconpos[[COLOR="Red"]1[/COLOR]].x = CARGO1_pos.x;
	Cbeaconpos[[COLOR="Red"]1[/COLOR]].y = CARGO1_pos.y;
	Cbeaconpos[[COLOR="Red"]1[/COLOR]].z = CARGO1_pos.z;
For some reason Cargo 16 seems to cause the distortion. If I comment the SetAttachments for CArgo 16 no distortion

Like they say in a certain TV show: "Well, there's your problem!"

If you start putting things in the Cbeaconpos array in position 1, then when you get to the position 16 you will be writting outside the array, very likely over some other important stuff. Your "CARGO1" stuff should go in Cbeaconpos[0] (....) all the way to "CARGO16" in Cbeaconpos[15].
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,690
Reaction score
2,670
Points
203
Location
Dallas, TX
so it should be this:
Code:
CARGO1_pos.z = CARGO1_INT_POS - (CARGO1_proc * 5);
	SetAttachmentParams(CARGO1, CARGO1_pos, _V(0, -1, 0), _V(0, 0, -1));
	Cbeaconpos[0].x = CARGO1_pos.x;
	Cbeaconpos[0].y = CARGO1_pos.y;
	Cbeaconpos[0].z = CARGO1_pos.z;

	CARGO2_pos.z = CARGO2_INT_POS - (CARGO2_proc * 5);
	SetAttachmentParams(CARGO2, CARGO2_pos, _V(0, -1, 0), _V(0, 0, -1));
	Cbeaconpos[1].x = CARGO2_pos.x;
	Cbeaconpos[1].y = CARGO2_pos.y;
	Cbeaconpos[1].z = CARGO2_pos.z;

	CARGO3_pos.z = CARGO3_INT_POS - (CARGO3_proc * 5);
	SetAttachmentParams(CARGO3, CARGO3_pos, _V(-0.866, -0.5, 0), _V(0, 0, -1));
	Cbeaconpos[2].x = CARGO3_pos.x;
	Cbeaconpos[2].y = CARGO3_pos.y;
	Cbeaconpos[2].z = CARGO3_pos.z;
 

GLS

Well-known member
Orbiter Contributor
Addon Developer
Joined
Mar 22, 2008
Messages
5,914
Reaction score
2,908
Points
188
Website
github.com
so it should be this:
Code:
CARGO1_pos.z = CARGO1_INT_POS - (CARGO1_proc * 5);
	SetAttachmentParams(CARGO1, CARGO1_pos, _V(0, -1, 0), _V(0, 0, -1));
	Cbeaconpos[0].x = CARGO1_pos.x;
	Cbeaconpos[0].y = CARGO1_pos.y;
	Cbeaconpos[0].z = CARGO1_pos.z;

	CARGO2_pos.z = CARGO2_INT_POS - (CARGO2_proc * 5);
	SetAttachmentParams(CARGO2, CARGO2_pos, _V(0, -1, 0), _V(0, 0, -1));
	Cbeaconpos[1].x = CARGO2_pos.x;
	Cbeaconpos[1].y = CARGO2_pos.y;
	Cbeaconpos[1].z = CARGO2_pos.z;

	CARGO3_pos.z = CARGO3_INT_POS - (CARGO3_proc * 5);
	SetAttachmentParams(CARGO3, CARGO3_pos, _V(-0.866, -0.5, 0), _V(0, 0, -1));
	Cbeaconpos[2].x = CARGO3_pos.x;
	Cbeaconpos[2].y = CARGO3_pos.y;
	Cbeaconpos[2].z = CARGO3_pos.z;

Yep!
In C and C++ (and other languages) arrays are 0-based. If you declare int abc[5];, your 5 integers in the abc array are abc[0], abc[1], abc[2], abc[3], and abc[4]. You just have to change your mind to start counting things from 0. :lol:
 

Capt_hensley

Captain, USS Pabilli
Donator
Joined
Oct 20, 2010
Messages
841
Reaction score
0
Points
16
Location
Alamogordo
Website
www.h-10-k.com
declare and Initialize the variable with "abc as integer = 1", and the array will work with real numbers greater than zero.
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,690
Reaction score
2,670
Points
203
Location
Dallas, TX
Thanks. We think we have The endurance fixed. The ranger still working on. But one issue is the front part of the ship raises/lowers like a elevator.

But there RCS and hover jets on that part. So I would need to calculet the vector of the rcs and hover exhaust as they move with the nose.
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,690
Reaction score
2,670
Points
203
Location
Dallas, TX
ok. Another issue. I hope someone can spot why. We want to be able to have TARS or CASE on board.

So we set up the meshes 6 crew (0-5) and main mesh 6 and vc mesh 7
Code:
meshi_CREW[VC_STATION_PILOT] = AddMesh(meshhg_CREW[VC_STATION_PILOT] = oapiLoadMeshGlobal(FILENAME_LANDERCREW1NEW));// mesh0
	meshi_CREW[VC_STATION_COPILOT] = AddMesh(meshhg_CREW[VC_STATION_COPILOT] = oapiLoadMeshGlobal(FILENAME_LANDERCREW2NEW));//mesh1
	meshi_CREW[VC_STATION_PAX_LEFT] = AddMesh(meshhg_CREW[2] = oapiLoadMeshGlobal(FILENAME_LANDERCREW3NEW));//mesh2
	meshi_CREW[VC_STATION_PAX_RIGHT] = AddMesh(meshhg_CREW[VC_STATION_PAX_RIGHT] = oapiLoadMeshGlobal(FILENAME_LANDERCREW4NEW));//mesh3
	meshi_CREW[VC_STATION_CASE] = AddMesh(meshhg_CREW[VC_STATION_CASE] = oapiLoadMeshGlobal(FILENAME_CREW_CASE_ANIMATED_B));//mesh4
	meshi_CREW[VC_STATION_TARS] = AddMesh(meshhg_CREW[VC_STATION_TARS] = oapiLoadMeshGlobal(FILENAME_CREW_TARSLANDER_ANIMATEDNEW));//mesh5

	for (int i = 0; i < VC_STATION_SIZE; i++)
		SetMeshVisibilityMode(meshi_CREW[i], MESHVIS_NEVER);

	// visual specs
	SetMeshVisibilityMode(meshi_Vessel = AddMesh(meshhg_Vessel = oapiLoadMeshGlobal(FILENAME_LANDER15)), MESHVIS_ALWAYS); //Main ship mesh6
	SetMeshVisibilityMode(meshi_VC = AddMesh(meshhg_VC = oapiLoadMeshGlobal(FILENAME_LANDER15VC)), MESHVIS_VC);//MESH 7

so now if a ummu exits or enters we need to show a mesh inside. So if TARS enters shows TARS mesh and if CASE enters show CASE mesh.
Code:
void LANDER6::UpdateCrew() {
	int const crewn = Crew.GetCrewTotalNumber();

	for (int i = 0; i < 5; i++) SetMeshVisibilityMode(meshi_CREW[i], MESHVIS_NEVER);// clears MESHES

	 {
		int chair = 0;
		for (int i = 0; i < crewn; i++) {
			const char *pMiscID = Crew.GetCrewMiscIdBySlotNumber(i);
			if (!_strnicmp(pMiscID, "TARS", 4))
				SetMeshVisibilityMode(meshi_CREW[VC_STATION_TARS], MESHVIS_ALWAYS);

			else if (!_strnicmp(pMiscID, "CASE", 4))
				SetMeshVisibilityMode(meshi_CREW[VC_STATION_CASE], MESHVIS_ALWAYS);
			
			else {
				SetMeshVisibilityMode(meshi_CREW[chair++], MESHVIS_ALWAYS);
			}
		}
	}
}

Code:
#define VC_STATION_FIRST_ID 0
#define VC_STATION_PILOT (0+VC_STATION_FIRST_ID)
#define VC_STATION_COPILOT (1+VC_STATION_PILOT)
#define VC_STATION_PAX_LEFT (1+VC_STATION_COPILOT)
#define VC_STATION_PAX_RIGHT (1+VC_STATION_PAX_LEFT)
#define VC_STATION_CASE (1+VC_STATION_PAX_RIGHT)
#define VC_STATION_TARS (1+VC_STATION_CASE)
#define VC_STATION_SIZE (1+VC_STATION_TARS)
So what happens if CASE enters case mesh is shown and if CASE exits no mesh is shown. :thumbup:
BUT not the case for TARS. when TARS enters no TARS mesh is shown. If I restart then TARS is seen. But then I exit TARS the mesh is still seen.

Code:
LANDER:LANDER
  STATUS Landed Earth
  POS -80.6798960 28.5997140
  HEADING 77.55
  AFCMODE 7
  PRPLEVEL 0:1.000000 1:1.000000 2:1.000000
  IDS 0:588 100 1:589 100
  NAVFREQ 0 0
  XPDR 0
  DOOR 1 1.0000
  DOOR1 1 1.0000
  BLAST 0 0.0000
  UPDOOR 0 0.0000
  LODOOR 0 0.0000
  UMMUCREW TARS-TARS-22-64-120
END
 

GLS

Well-known member
Orbiter Contributor
Addon Developer
Joined
Mar 22, 2008
Messages
5,914
Reaction score
2,908
Points
188
Website
github.com
So we set up the meshes 6 crew (0-5) and main mesh 6 and vc mesh 7
Code:
for (int i = 0; i < 5; i++) SetMeshVisibilityMode(meshi_CREW[i], MESHVIS_NEVER);// clears MESHES

The loop only runs 5 times (0-4), so the last one (TARS) is left out.
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,690
Reaction score
2,670
Points
203
Location
Dallas, TX
Thanks. I thought about that. If I set it to 6 then when TARS exit he is still seen and the VC isn't seen.
Code:
    for (int i = 0; i < 6; i++) SetMeshVisibilityMode(meshi_CREW[i], MESHVIS_NEVER);// clears MESHES


---------- Post added at 05:27 AM ---------- Previous post was at 05:16 AM ----------

So I did this:
Code:
meshi_CREW[0] = AddMesh(meshhg_CREW[VC_STATION_PILOT] = oapiLoadMeshGlobal(FILENAME_LANDERCREW1NEW));// mesh0
    meshi_CREW[1] = AddMesh(meshhg_CREW[VC_STATION_COPILOT] = oapiLoadMeshGlobal(FILENAME_LANDERCREW2NEW));//mesh1
    meshi_CREW[2] = AddMesh(meshhg_CREW[2] = oapiLoadMeshGlobal(FILENAME_LANDERCREW3NEW));//mesh2
    meshi_CREW[3] = AddMesh(meshhg_CREW[VC_STATION_PAX_RIGHT] = oapiLoadMeshGlobal(FILENAME_LANDERCREW4NEW));//mesh3
    meshi_CREW[4] = AddMesh(meshhg_CREW[VC_STATION_CASE] = oapiLoadMeshGlobal(FILENAME_CREW_CASE_ANIMATED_B));//mesh4
    meshi_CREW[5] = AddMesh(meshhg_CREW[VC_STATION_TARS] = oapiLoadMeshGlobal(FILENAME_CREW_TARSLANDER_ANIMATEDNEW));//mesh5

    for (int i = 0; i < 6; i++)
        SetMeshVisibilityMode(meshi_CREW[i], MESHVIS_NEVER);

    // visual specs
    SetMeshVisibilityMode(meshi_Vessel = AddMesh(meshhg_Vessel = oapiLoadMeshGlobal(FILENAME_LANDER15)), MESHVIS_ALWAYS); //Main ship mesh6
    SetMeshVisibilityMode(meshi_VC = AddMesh(meshhg_VC = oapiLoadMeshGlobal(FILENAME_LANDER15VC)), MESHVIS_VC);//MESH 7
So now if TARS enters I get no VC but with CASE I do. It is like the mesh Index is hacked

---------- Post added at 05:50 AM ---------- Previous post was at 05:27 AM ----------

I fixed it.
I forgot to update these.:blush:
Code:
    MESHHANDLE meshhg_Vessel, meshhg_VC, meshhg_CREW[6];
    UINT meshi_Vessel, meshi_VC, meshi_CREW[6];
 
Last edited:

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,690
Reaction score
2,670
Points
203
Location
Dallas, TX
I upgraded to Vessel 3.

Running the debugger to see another issue but now I am having issues with vc.

Code:
void RANGER::RedrawPanel_CENTERINFOstatus(SURFHANDLE surf, int part)

{

    char cbuf[20];
    HDC hDC = oapiGetDC(surf);
    SetBkMode(hDC, TRANSPARENT);

    SetTextColor(hDC, RGB(0, 153, 0));



    SelectObject(hDC, g_Param.hFont[3]);

    
    if (GEAR_status == GEAR_DOWN) {
        sprintf(cbuf, "GEAR", 4);
        SetTextColor(hDC, RGB(0, 153, 0));
        TextOut(hDC, 25, 40, cbuf, strlen(cbuf));
    }
    if (GEAR_status == GEAR_UP) {
        sprintf(cbuf, "GEAR", 4);
        SetTextColor(hDC, RGB(255, 0, 0));
        TextOut(hDC, 25, 40, cbuf, strlen(cbuf));
    }

    if ((GEAR_status == GEAR_RAISING) || (GEAR_status == GEAR_LOWERING)){
        sprintf(cbuf, "GEAR", 4);
        SetTextColor(hDC, RGB(255, 255, 0));
        TextOut(hDC, 25, 40, cbuf, strlen(cbuf));
    }

    if ((DOOR_proc>0) && (DOOR_proc<1)) {
        sprintf(cbuf, "MAIN HATCH", 10);
        SetTextColor(hDC, RGB(255, 255, 0));
        TextOut(hDC, 25, 70, cbuf, strlen(cbuf));
    }
    if (DOOR_proc==1) {
        sprintf(cbuf, "MAIN HATCH", 10);
        SetTextColor(hDC, RGB(255, 0, 0));
        TextOut(hDC, 25, 70, cbuf, strlen(cbuf));
    }
    if (DOOR_proc == 0) {
        sprintf(cbuf, "MAIN HATCH", 10);
        SetTextColor(hDC, RGB(0, 153, 0));
        TextOut(hDC, 25, 70, cbuf, strlen(cbuf));
    }
    
    if ((DOOR1_proc>0) && (DOOR1_proc<1)) {
        sprintf(cbuf, "DOCK HATCH", 10);
        SetTextColor(hDC, RGB(255, 255, 0));
        TextOut(hDC, 25, 100, cbuf, strlen(cbuf));
    }
    if (DOOR1_proc == 1) {
        sprintf(cbuf, "DOCK HATCH", 10);
        SetTextColor(hDC, RGB(255, 0, 0));
        TextOut(hDC, 25, 100, cbuf, strlen(cbuf));
    }
    if (DOOR1_proc == 0) {
        sprintf(cbuf, "DOCK HATCH", 10);
        SetTextColor(hDC, RGB(0, 153, 0));
        TextOut(hDC, 25, 100, cbuf, strlen(cbuf));
    }


    SelectObject(hDC, g_Param.hFont[2]);

    SetTextColor(hDC, RGB(0, 153, 0));

    sprintf(cbuf, "%0.1f", RANGERPITCH1);
    TextOut(hDC, 170, 200, cbuf, strlen(cbuf));

    sprintf(cbuf, "%0.1f", RANGERYAW1);
    TextOut(hDC, 170, 250, cbuf, strlen(cbuf));

    sprintf(cbuf, "%0.1f", RANGERROLL1);
    TextOut(hDC, 170, 300, cbuf, strlen(cbuf));

    sprintf(cbuf, "%0.1f", RANGERNOSE);
    TextOut(hDC, 170, 350, cbuf, strlen(cbuf));


    sprintf(cbuf, "PITCH", 5);
    TextOut(hDC, 100, 200, cbuf, strlen(cbuf));

    sprintf(cbuf, "HDG", 3);
    TextOut(hDC, 100, 250, cbuf, strlen(cbuf));

    sprintf(cbuf, "ROLL", 4);
    TextOut(hDC, 100, 300, cbuf, strlen(cbuf));

    sprintf(cbuf, "NOSE", 4);
    TextOut(hDC, 100, 350, cbuf, strlen(cbuf));

    oapiReleaseDC(surf, hDC);
}
the debuuger stops on the oapiReleaseDC line.

Not sure why

---------- Post added at 08:55 PM ---------- Previous post was at 07:31 PM ----------

I fixed it. I needed to initialize the rangerroll1,,....

The next issue is a logic one. Because of the position on the HUD the pilot or copilot (depending on the view) their mesh needs to set as not seen.

I had that. But what happened is when a crew was added it updated the crew and now the pilot or co pilot is seen.
this makes all mesh not seen then if TARS or CASE are crew show the correct mesh and then show the crew.

Code:
void RANGER::UpdateCrew() {
	int const crewn = Crew.GetCrewTotalNumber();

	for (int i = 0; i < 6; i++) SetMeshVisibilityMode(meshi_CREW[i], MESHVIS_NEVER);// clears MESHES

	{
		int chair = 0;
		for (int i = 0; i < crewn; i++) {
			const char *pMiscID = Crew.GetCrewMiscIdBySlotNumber(i);
			if (!_strnicmp(pMiscID, "TARS", 4))
				SetMeshVisibilityMode(meshi_CREW[4], MESHVIS_ALWAYS);

			else if (!_strnicmp(pMiscID, "CASE", 4))
				SetMeshVisibilityMode(meshi_CREW[5], MESHVIS_ALWAYS);

			else {
				SetMeshVisibilityMode(meshi_CREW[chair++], MESHVIS_ALWAYS);
			}
		}
	}
}
This changes the hud center and makes not seen the pilot or copilot mesh.
Code:
	int const crewn = Crew.GetCrewTotalNumber();
	switch (viewController->station()->id) {
	case VC_STATION_PILOT:
		// Yes, we are on the Pilot station right now
		huds.hudcnt = _V(-.954, 1.19, .55);
		

		

		
			
		for (int i = 0; i < crewn; i++) {
			const char *pMiscID = Crew.GetCrewMiscIdBySlotNumber(0);
			if ((crewn==1) && (_strnicmp(pMiscID, "TARS", 4)) || (_strnicmp(pMiscID, "CASE", 4)))
			{




				SetMeshVisibilityMode(0, MESHVIS_NEVER);//DO NOT SHOW PILOT MESH
				//SetMeshVisibilityMode(0, MESHVIS_VC);//BUT SHOW THE COPILOTS
			}
		}
		break;

	case VC_STATION_COPILOT:
		// Yes, we are on the COPilot station right now
		huds.hudcnt = _V(.954, 1.19, .55);
		//SetAnimation(anim_DOOR,1);
		for (int i = 0; i < crewn; i++) {
			const char *pMiscID = Crew.GetCrewMiscIdBySlotNumber(1);
			if ((crewn==2) && (_strnicmp(pMiscID, "TARS", 4)) || (_strnicmp(pMiscID, "CASE", 4)))
			{
				SetMeshVisibilityMode(0, MESHVIS_VC);//SHOW PILOT MESH
				SetMeshVisibilityMode(1, MESHVIS_NEVER);//BUT DO NOT SHOW THE COPILOTS
			}
		}
		break;

	default:
		// Never show any of them

		if (crewn > 1){
			const char *pMiscID = Crew.GetCrewMiscIdBySlotNumber(0);

			if ((_strnicmp(pMiscID, "TARS", 4)) || (_strnicmp(pMiscID, "CASE", 4)))
		

			SetMeshVisibilityMode(0, MESHVIS_ALWAYS);
		}
		if (crewn > 2) {
			const char *pMiscID = Crew.GetCrewMiscIdBySlotNumber(1);
			
			if ((_strnicmp(pMiscID, "TARS", 4)) || (_strnicmp(pMiscID, "CASE", 4)))
		
			SetMeshVisibilityMode(1, MESHVIS_ALWAYS);
		}
		break;
	}
So the update crew is in the poststep. So it overrides the code that tells the pilot ot copilot mesh to be seen or not.
 
Top