Orbiter-Forum  

Go Back   Orbiter-Forum > Orbiter Addons > Addon Requests
Register Blogs Orbinauts List Social Groups FAQ Projects Mark Forums Read

Addon Requests If you have a request for a new addon or want to know where to find a specific addon, ask it here!

Reply
 
Thread Tools
Old 03-21-2017, 03:50 PM   #91
gattispilot
Addon Developer
 
gattispilot's Avatar
Default

why what?

Wouldn't need to store it to compare the difference. to see if you are coming or going

Or just make a timer that once you went thru counts and after a set time the gate is open again. So you can only go thru one at a time.
gattispilot is offline   Reply With Quote
Old 03-21-2017, 03:59 PM   #92
Urwumpe
Not funny anymore
 
Urwumpe's Avatar

Default

Why if you already have the velocity?
Urwumpe is offline   Reply With Quote
Old 03-22-2017, 11:00 AM   #93
gattispilot
Addon Developer
 
gattispilot's Avatar
Default

So what is needed to get this going?

As you said it is easy just need to prevent the going back and forth. So you thru and it starts a timer. And closes the gate. Then when the timer expires the gate is open

---------- Post added 03-22-17 at 06:00 AM ---------- Previous post was 03-21-17 at 11:18 AM ----------

How easy is this going to be to code?

I guess get each vessel's position, right and then see if you are close and going thru forward.
gattispilot is offline   Reply With Quote
Old 03-22-2017, 11:20 AM   #94
Urwumpe
Not funny anymore
 
Urwumpe's Avatar

Default

Quote:
Originally Posted by gattispilot View Post
 
How easy is this going to be to code?
Really easy.

But I won't code it for you - if you expect this kind of help, I'll do it myself in about 2019.

You just need to accept the hard reality of having to solve geometric problems with geometric solutions. That is all.

Also, as long as you are not understanding what your own code does, your code will do everything. Except the action you want.
Urwumpe is offline   Reply With Quote
Thanked by:
Old 03-28-2017, 12:35 PM   #95
gattispilot
Addon Developer
 
gattispilot's Avatar
Default

Just thinking outload.

But couldn't it be as easy as in the gateway vessel press a key get the gateway location and copy that to the vessel entering the gateway?

For me only one vessel "Endurance".

I haven't tried the jumpgate yet.
gattispilot is offline   Reply With Quote
Old 04-21-2017, 07:22 PM   #96
grid4dante
Orbinaut
Default

I've been running some tests on the wormhole, and here is what I've encountered so far:

-There has to be a preload pass through the origin wormhole to wake it up, and you have to either do a retro burn or rotate and main burn to move back into it to make the jump to the destination wormhole. I've tried sending another vessel through first to wake it up, but it seems to be specific to the vessel you want to travel through.

-Randomly, the event horizon of the wormhole seems to change. After completing the initial "wake up" pass, the point that the vessel actually makes the jump seems to change randomly from right at the wormhole to sometimes many meters from it.

-The direction of flight seems to change randomly at times so that, upon exit, the vessel goes from travelling in normal orientation (nose and vector of travel are both aligned) to an off orientation (nose is aligned coming out of the destination wormhole, but vector of travel is off of the port wing, for example).
grid4dante is offline   Reply With Quote
Thanked by:
Old 04-21-2017, 09:45 PM   #97
gattispilot
Addon Developer
 
gattispilot's Avatar
Default

We found that the vessel entering the gateway must be very slow. Strange because speed is not figured in just distance.
gattispilot is offline   Reply With Quote
Old 09-26-2017, 10:24 AM   #98
gattispilot
Addon Developer
 
gattispilot's Avatar
Default

So this is what I have for code. But when I press K to jump it nothing happens.

Code:
WORMHOLE::WORMHOLE (OBJHANDLE hObj, int fmodel)
: VESSEL2 (hObj, fmodel)

{
	
	jump = 0;

}

void WORMHOLE::clbkSetClassCaps (FILEHANDLE cfg)
{
	// physical specs
	SetSize (500);
	SetEmptyMass (1000.0);
	SetCW (0.3, 0.3, 0.6, 0.9);
	SetWingAspect (1.7);
	SetWingEffectiveness (14.1);
	SetCrossSections (_V(5.4, 5.4,25.77 ));
	SetRotDrag (_V(3.5,3.5,3.5));
	if (GetFlightModel() >= 1) {
		SetPitchMomentScale (1e-4);
		SetBankMomentScale (1e-4);
	}
	SetPMI (_V(2.58,2.57, 12.00));
	SetTrimScale (0.08);
	SetCameraOffset (_V(0,2.5,0));
SetTouchdownPoints  (_V(0,.01,5.7), _V(-3.448,.01,-5.0), _V(3.448,.01,-5.0));; 



EnableTransponder (true);

	// propellant resources

//SetMeshVisibilityMode(AddMesh(oapiLoadMeshGlobal("INTERSTELLAR\\VESSEL\\WHole")), MESHVIS_ALWAYS); //Main ship mesh

SetMeshVisibilityMode(AddMesh(oapiLoadMeshGlobal("gateway")), MESHVIS_ALWAYS); //Main ship mesh




}

void WORMHOLE::clbkPostStep(double simt, double simdt, double mjd)
{
	
	for (UINT i = 0; i<oapiGetVesselCount(); i++)
	{
		OBJHANDLE hvessel = oapiGetVesselByIndex(i);

		if (hvessel != GetHandle())
		{
			VECTOR3 rpos, rvel;
			oapiGetRelativePos(hvessel, GetHandle(), &rpos);
			double distance = length(rpos);
			oapiGetRelativeVel(hvessel, GetHandle(), &rvel);
		//	sprintf(oapiDebugString(), "distance %f rpos.z %f rvel.z %f", distance, rpos.z, rvel.z);
		//	if ((distance<1000) && (rpos.z>0) && (rvel.z<0))
			if (jump==1)

			{

				VESSELSTATUS2 vs_vessel, vs_other_gate;
				memset(&vs_vessel, 0, sizeof(vs_vessel));
				memset(&vs_other_gate, 0, sizeof(vs_other_gate));
				vs_vessel.version = 2;
				vs_other_gate.version = 2;

				VESSEL *v;
				v = oapiGetVesselInterface(hvessel);
				v->GetStatusEx(&vs_vessel);
				OBJHANDLE h_other_gate;
				char myname[16];
				char GateA[16];
				sprintf(myname, GetName());
				sprintf(GateA, "Gate_A");
				if (strcmp(myname, GateA) == 0)
				{
					h_other_gate = oapiGetVesselByName("Gate_B");
				}
				else{
					h_other_gate = oapiGetVesselByName("Gate_A");
				}
				VESSEL *v_other_gate;
				v_other_gate = oapiGetVesselInterface(h_other_gate);
				v_other_gate->GetStatusEx(&vs_other_gate);
				vs_vessel.rbody = vs_other_gate.rbody;
				vs_vessel.rpos = vs_other_gate.rpos;
				vs_vessel.vrot = vs_other_gate.vrot;
				vs_vessel.arot = vs_other_gate.arot;

				VECTOR3 outvel = _V(rvel.x, rvel.y, rvel.z);
				VECTOR3 rofs;
				GlobalRot(outvel, rofs);
				vs_vessel.rvel.x = vs_other_gate.rvel.x + rofs.x;
				vs_vessel.rvel.y = vs_other_gate.rvel.y + rofs.y;
				vs_vessel.rvel.z = vs_other_gate.rvel.z + rofs.z;

				jump = 0;




				v->DefSetStateEx(&vs_vessel);
			}
		}
	}


}
 








DLLCLBK VESSEL *ovcInit (OBJHANDLE hvessel, int flightmodel)
{
return new WORMHOLE (hvessel, flightmodel);
}

DLLCLBK void ovcExit(VESSEL *vessel)
{
	if (vessel) delete (WORMHOLE*)vessel;
}

// --------------------------------------------------------------
// Keyboard interface handler (buffered key events)
// --------------------------------------------------------------
int WORMHOLE::clbkConsumeBufferedKey(DWORD key, bool down, char *kstate)
{
	// only process keydown events
	if (!down) 
		return 0; 
	if (key == OAPI_KEY_K) // ATTACH
	{

		jump=1;
		return 1;
	}

	return 0;	
}


// ====================================================================
// clbkVisualCreated used to display UMMU initialisation message 
// because oapiDebugString() doesn't work in clbkSetClassCap
// ====================================================================
void WORMHOLE::clbkVisualCreated (VISHANDLE vis, int refcount)
{   
	MainExternalMeshVisual = GetMesh(vis,0);
	// We warn the user, in the case UMmu isn't installed it's a good idea to send a "oapiDebugString"
	// Orbiter message, otherwise your addon will not be fully operational and user may not notice. 
	//(nobody read doc, you may be the only one, if you read this send me a postcard ;)

}
// ==============================================================
// Visual destroyed
// ==============================================================
void WORMHOLE::clbkVisualDestroyed (VISHANDLE vis, int refcount)
{
	MainExternalMeshVisual = 0;	
}
scn:
Code:
BEGIN_SHIPS
Gate_A:WORMHOLE
  STATUS Orbiting Earth
  RPOS 3001430.11 -0.02 6332855.27
  RVEL -6815.014 -0.000 3229.950
  AROT 0.00 -0.00 0.00
  AFCMODE 7
  NAVFREQ 0 0
  XPDR 0
END
Gate_B:WORMHOLE
  STATUS Orbiting Moon
  RPOS 1373379.71 1280906.25 160751.21
  RVEL 1076.083 1059.868 51.698
  HEADING 66.83
  AFCMODE 7
  NAVFREQ 0 0
  XPDR 0
END
dg:Deltaglider
  STATUS Orbiting Earth
  RPOS 3001430.11 -0.02 6332855.27
  RVEL -6815.014 -0.000 3229.950
  AROT 180.00 23.87 180.00
  AFCMODE 7
  PRPLEVEL 0:0.986777 1:1.000000
  THLEVEL 0:0.027778 1:0.027778
  NAVFREQ 0 0 0 0
  XPDR 0
  AAP 0:0 0:0 0:0
END
END_SHIPS

Last edited by gattispilot; 09-26-2017 at 10:36 AM.
gattispilot is offline   Reply With Quote
Old 09-26-2017, 10:41 AM   #99
Urwumpe
Not funny anymore
 
Urwumpe's Avatar

Default

What about you invest some time writing a "WORMHOLE STATUS MFD" so you can look into your wormhole's module from within the DG to check the critical internal variables?
Urwumpe is offline   Reply With Quote
Thanked by:
Old 09-26-2017, 10:52 AM   #100
gattispilot
Addon Developer
 
gattispilot's Avatar
Default

Thanks. I was looking at the B5 jump gate.

He had a MFD.

Not sure what values I would look at.

As I understand the code. It gets info on the vessels. And moves the vessel from Gate_A to Gate_B if Jump =1.
gattispilot is offline   Reply With Quote
Old 09-26-2017, 11:09 AM   #101
Urwumpe
Not funny anymore
 
Urwumpe's Avatar

Default

Quote:
Originally Posted by gattispilot View Post
 Thanks. I was looking at the B5 jump gate.

He had a MFD.

Not sure what values I would look at.

As I understand the code. It gets info on the vessels. And moves the vessel from Gate_A to Gate_B if Jump =1.
For example you could care about the position of the vessel relative to your gate. Or if the jump had been triggered. Which gates are connected.

such things.

Jump=1 makes sense for Babylon 5, because jump points had to be opened by a jump drive (Unless you are a Shadow)
Urwumpe is offline   Reply With Quote
Thanked by:
Old 09-26-2017, 12:16 PM   #102
gattispilot
Addon Developer
 
gattispilot's Avatar
Default

Thanks.

Well for what I need there is just 2 gates.

Since the distance to the gate isn't the trigger yet. I want to see if you switch to the gate vessel and press K (Jump=1) then it should move any other vessel to the other gate position.
gattispilot is offline   Reply With Quote
Old 09-26-2017, 01:11 PM   #103
jedidia
shoemaker without legs
 
jedidia's Avatar
Default

Quote:
So this is what I have for code. But when I press K to jump it nothing happens.
Well, as far as I can see you don't actually apply the state to the vessel...
jedidia is offline   Reply With Quote
Thanked by:
Old 09-26-2017, 01:23 PM   #104
gattispilot
Addon Developer
 
gattispilot's Avatar
Default

Thanks
But isn't want this does:
Code:
				VESSEL *v_other_gate;
				v_other_gate = oapiGetVesselInterface(h_other_gate);
				v_other_gate->GetStatusEx(&vs_other_gate);
				vs_vessel.rbody = vs_other_gate.rbody;
				vs_vessel.rpos = vs_other_gate.rpos;
				vs_vessel.vrot = vs_other_gate.vrot;
				vs_vessel.arot = vs_other_gate.arot;

				VECTOR3 outvel = _V(rvel.x, rvel.y, rvel.z);
				VECTOR3 rofs;
				GlobalRot(outvel, rofs);
				vs_vessel.rvel.x = vs_other_gate.rvel.x + rofs.x;
				vs_vessel.rvel.y = vs_other_gate.rvel.y + rofs.y;
				vs_vessel.rvel.z = vs_other_gate.rvel.z + rofs.z;

				jump = 0;




				v->DefSetStateEx(&vs_vessel);
gattispilot is offline   Reply With Quote
Old 09-26-2017, 02:56 PM   #105
jedidia
shoemaker without legs
 
jedidia's Avatar
Default

Ah, yes, it is. There was so much empty space between the previous line of code and this that I didn't see it.
jedidia is offline   Reply With Quote
Thanked by:
Reply

  Orbiter-Forum > Orbiter Addons > Addon Requests


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 05:38 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.