Request Gateway transport system

jedidia

shoemaker without legs
Addon Developer
Joined
Mar 19, 2008
Messages
10,877
Reaction score
2,131
Points
203
Location
between the planets
The values look like they would fit the if statement.

They really don't, but I have no idea why they're so screwed up. Oh wait... I'm bloody stupid, that's why. What we're doing currently is take the global difference between the vessel and the gate, then convert that to gate-local coordinates. Which of course doesn't work, because it will assume it's a global position. Sorry about that.

I'm away with the family for the weekend, so I don't have the documentation with me, but basically we just have to convert the global coordinates of the vessel to gate relative coordinates. Something like:

Code:
VECTOR3 vesselpos = _V(0, 0, 0);
VECTOR3 gaterelative_pos = _V(0, 0, 0);
oapiGetGlobalPos(hvessel, &vesselpos);
oapiGlobalToLocal(GetHandle(), &vesselpos, &gaterelative_pos);

That should work a lot better. All the rest of that code was to calculate the distance, which we no longer need.
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,714
Reaction score
2,684
Points
203
Location
Dallas, TX
So now I get these:
+ gaterelative_pos {data=0x00aefb84 {5.1345761821979119e+116, 9.8505114168702800e+101, 2.5719407100470090e+302} x=5.1345761821979119e+116 ...} VECTOR3

+ gaterelative_pos {data=0x00aefb84 {1.4197756469057205e-303, 6.3785510935387878e+039, 3.6294963635608317e+256} x=1.4197756469057205e-303 ...} VECTOR3

+ gaterelative_pos {data=0x00aefb84 {2.5495707172836340e-019, -2.8784520917151861e-144, 5.1560115685895657e+047} x=2.5495707172836340e-019 ...} VECTOR3

- gaterelative_pos {data=0x00aefb84 {-34091315158.685516, 5.3473215745503613e+293, -1.0339652495273564e+264} x=-34091315158.685516 ...} VECTOR3

- gaterelative_pos {data=0x00aefb84 {5.0877956172307101e-216, -1.4124038242605080e+086, 4.9620602510284287e+180} x=5.0877956172307101e-216 ...} VECTOR3
Code:
VECTOR3 vesselpos = _V(0, 0, 0);
			VECTOR3 gaterelative_pos = _V(0, 0, 0);
			oapiGetGlobalPos(hvessel, &vesselpos);
			oapiGlobalToLocal(GetHandle(), &vesselpos, &gaterelative_pos);
			

		//	if ((gaterelative_pos.x<-500) || (gaterelative_pos.x>500) || (gaterelative_pos.y<-500) || (gaterelative_pos.y>500) || (gaterelative_pos.x<-10) || (gaterelative_pos.x>10)) jump = true;
			//double distance = length(relpos);
			// if (distance < triggerdistance) jump = true;
			if (((-500<gaterelative_pos.x) && (gaterelative_pos.x>500)) && ((-500<gaterelative_pos.y) && (gaterelative_pos.y>500)) && ((-10<gaterelative_pos.z) && (gaterelative_pos.z>10)))
 

jedidia

shoemaker without legs
Addon Developer
Joined
Mar 19, 2008
Messages
10,877
Reaction score
2,131
Points
203
Location
between the planets
So, finally home from family weekend. Those values keep being erratic and nonsensical, and I'd like to take a look at it just to rule out the possibility that your debugger has a wonky configuration.
Can you zip up the header file, cpp file, project file and the scenario and post them here?
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,714
Reaction score
2,684
Points
203
Location
Dallas, TX
Thanks I think this is what you need . Included a mesh that I have been using.
 

Attachments

  • wormholetest.zip
    5.5 KB · Views: 2

jedidia

shoemaker without legs
Addon Developer
Joined
Mar 19, 2008
Messages
10,877
Reaction score
2,131
Points
203
Location
between the planets
Thanks, will give it a whirl tomorrow evening. It's already a bit late over here.

---------- Post added at 10:45 PM ---------- Previous post was at 09:54 PM ----------

After a quick look at the package, it looks like you put in the solution file instead of the project file. I'll need the project file, as that is the one containing all the project settings like compiler etc.

Also, I realised I'll need the cfg for the wormhole.
 

mrozigor

Donator
Donator
Joined
May 14, 2010
Messages
24
Reaction score
0
Points
16
Location
Wrocław
I think that this statements should look a little bit different:
Code:
(-500<gaterelative_pos.x) && (gaterelative_pos.x>500)

If I understood you correctly, position should be in range <-500; 500> and now it looks more like (500; +inifinity).
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,714
Reaction score
2,684
Points
203
Location
Dallas, TX
Confused. The jump should occur if the relative x position of the vessel to gate is between -500 and 500. The gateway mesh is 1000 meters wide
 

jedidia

shoemaker without legs
Addon Developer
Joined
Mar 19, 2008
Messages
10,877
Reaction score
2,131
Points
203
Location
between the planets
The jump should occur if the relative x position of the vessel to gate is between -500 and 500.

Yes, but that's not what that statement does. I overlooked that little detail, among other thing because of your unorthodox way to write comparisons. If you write the statement in a more conventional manner, you'll see pretty quickly what is wrong with it:

Code:
gaterelative_pos.x > -500 && gaterelative_pos.x>500

That's why there's best practices on how to write certain things. Sure, your way works (if it was written correctly), but it's much harder to spot errors.
 

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,617
Reaction score
2,337
Points
203
Location
Wolfsburg
Preferred Pronouns
Sire
Confused. The jump should occur if the relative x position of the vessel to gate is between -500 and 500. The gateway mesh is 1000 meters wide

So you mean in simple mathematical form: Any x which is bigger than -500 and smaller than 500.

And you can translate this description easily to C++:

x > -500 && x < 500


Though for a rounded gate, I would rather use a cylindrical coordinate system

[math]r^2 = x^2 + y^2[/math]
Which translates well to:

Code:
r_squared = pow(x, 2) + pow(y, 2);

I could then define some constants in the header file like:

Code:
const double GATE_RADIUS = 500.0;
const double GATE_RADIUS_SQUARED = pow(GATE_RADIUS, 2);


and then ask:

Code:
if( r_squared < GATE_RADIUS_SQUARED )

You know, I like confusing people.
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,714
Reaction score
2,684
Points
203
Location
Dallas, TX
We got to get the rel position numbers correct first. And then if the z distance is >-10 and <10.
 

jedidia

shoemaker without legs
Addon Developer
Joined
Mar 19, 2008
Messages
10,877
Reaction score
2,131
Points
203
Location
between the planets

Uhm, no. You don't need that. That's for passing comparison functions as arguments to function calls. Probably a bit too advanced for you at this point. All I wanted to say was, write your code in a readable way, and it's a lot easier to spot errors. The only greater-than operator you need is the standard >

We got to get the rel position numbers correct first. And then if the z distance is >-10 and <10.

Which will define a cuboid shape around the wormhole. Urwumpe is suggesting that a cylinder would be better suited, and he's right of course. Still, let's get this to run first before optimising.

---------- Post added at 08:02 PM ---------- Previous post was at 03:14 PM ----------

Oh try this

Uhm... That's the wrong project file. I don't know what E3VIP is, but it certainly isn't this project.

Now, I could just quickly set the two files up in a new project, but that would kind of defy the purpose of checking it out with your settings. So to really help you, I'll need that project file.
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,714
Reaction score
2,684
Points
203
Location
Dallas, TX
Ok not sure then;
Code:
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.21005.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wormhole", "E3VIP.vcxproj", "{1A57C099-C6AF-43A7-8899-83608A6FF011}"
EndProject

Isn't E3vip the project file

C:\orbiter100830\Orbitersdk\samples\WORMHOLE2\E3VIP.vcxproj shows to be the project file

I was going to make a new project with property sheets I knew there was something about that but can't find it. So if you want just make a new project.

---------- Post added 10-10-17 at 05:59 AM ---------- Previous post was 10-09-17 at 03:56 PM ----------

Ok. So I wanted to really go back to scratch.

So I followed this:
https://www.orbiter-forum.com/showthread.php?t=28786&highlight=project+sheets

I get this;
6Nbauox.jpg


then I went here to get the property sheets:
ydy2rwe.jpg



But will I need to change the directory in the properties?
 
Last edited:

jedidia

shoemaker without legs
Addon Developer
Joined
Mar 19, 2008
Messages
10,877
Reaction score
2,131
Points
203
Location
between the planets
That project file references files that aren't there, and as far as I can tell it doesn't reference wormhole.cpp and wormhole.h.

I fact, looking at your screenshots from earlier, I can clearly see that there's a project called "wormhole" in that solution. Ergo, there should be a "wormhole.vcxproj" around, usually in the same location as the source and header files.

---------- Post added at 11:03 AM ---------- Previous post was at 10:59 AM ----------

But will I need to change the directory in the properties?

I don't think so. Honestly, I've never set up a project with property sheets (My projects usually take a while, so the last time I set up an orbiter project was... huh... over 5 years ago?). But if I understand it right, the property sheet should take care of your orbiter include and lib directory, as well as proper compiler settings. Might be wrong on that, though.
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,714
Reaction score
2,684
Points
203
Location
Dallas, TX
Ok. What If I just start a new project the right way and then add in the cpp and h.
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,714
Reaction score
2,684
Points
203
Location
Dallas, TX
Well less trash in the solution.

Yes I thought the idea of property sheets was it would load in all that stuff.
https://www.orbiter-forum.com/showthread.php?p=378725&postcount=5

I didn't see expert setting but I think I got to the area. I would like to see what it looks like though.

---------- Post added at 04:07 PM ---------- Previous post was at 07:13 AM ----------

So I have edited this

orbiteroot.vsprops
to reflect my orbiter directory c:\100830orbiter
Code:
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <ImportGroup Label="PropertySheets">
  </ImportGroup>
  <PropertyGroup Label="UserMacros">
    <OrbiterDir>c:\orbiter100830\</OrbiterDir>
  </PropertyGroup>
  <PropertyGroup>
    <_ProjectFileVersion>12.0.21005.1</_ProjectFileVersion>
  </PropertyGroup>
  <ItemDefinitionGroup />
  <ItemGroup>
    <BuildMacro Include="OrbiterDir">
      <Value>$(OrbiterDir)</Value>
      <EnvironmentVariable>true</EnvironmentVariable>
    </BuildMacro>
  </ItemGroup>
</Project>

It compiled but not sure if it made a dll.
 

jedidia

shoemaker without legs
Addon Developer
Joined
Mar 19, 2008
Messages
10,877
Reaction score
2,131
Points
203
Location
between the planets
It compiled but not sure if it made a dll.

The way to find out that requires me to write the least: Delete the dll currently in the modules folder, build, and see if it's there again.
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,714
Reaction score
2,684
Points
203
Location
Dallas, TX
Can you just add those in a project. I am not having any luck setting up a new project.
 
Top