Page 1 of 1

position = "x y z" in planetinfo.plist

Posted: Mon Aug 13, 2007 12:16 pm
by Commander McLane
Can anybody (perhaps Ahruman from a look into the code?) tell me which coordinate-system is used to define the position of a new planet/moon in planetinfo.plist?

It is not any of the usual ones we use to add ships to the Ooniverse.

I made some tries with adding a planet, but it won't appear where I want it to.

Examples: If I put it at

Code: Select all

position = "0 0 -1000000";
it will appear close to pwm 0 0 1500000 in my system, where the witchpoint buoy is at pwm 0 0 500000, so it seems to use a -wpm system. But it seems to be more complex. An entry

Code: Select all

position = "0 -500000 0";
moves it to a position at roughly pwm 454000 176000 485000 and

Code: Select all

position = "-500000 0 0";
has it at pwm -168000 440000 497000.

Obviously the z-axis of the position-command is close to (but not exactly on) the z-axis of pwm, but runs into the other direction. But the other two axes don't match with any axis in the system.

Now what I would like to have is an easy-to-do transformation from any given pwm-coordinates (that's the one on screen when pressing SHIFT-F) to the position-coordinates in a system where the witchpoint-buoy is located at pwm 0 0 500000. Then I could fly around, decide: "here I will place my planet", read the pwm-coords from the screen and transform them into the correct position-coordinates.

Is something like this possible? :?:

Posted: Mon Aug 13, 2007 12:34 pm
by TGHC
LB may be able to throw some light on it, he has done it successfully in Assassins

Posted: Mon Aug 13, 2007 1:48 pm
by LittleBear
It was a while ago and I did it by trial and error, then flew to where the planet was to add a station / ships by pwm. Think the first is the left right position looking into the system from the witch point, where zero is dead center and - and + effect the left or right. Think second is up / down and the third is distance from the witch point. The numbers don't relate to pwm in anyway I could see. I just looked at the position in game for Murgh's moon in Lave OXP. Took that as my start position, then moved it round until it looked right!

Posted: Mon Aug 13, 2007 2:32 pm
by Commander McLane
LittleBear wrote:
Think the first is the left right position looking into the system from the witch point, where zero is dead center and - and + effect the left or right. Think second is up / down and the third is distance from the witch point.
Okay, I'll give it a try and do some testing along these lines. The numbers I got so far (in my above post) seem to indicate, however, that it is a x,y,z-system with the same (or very similar) z-coord, but x and y are turned by an angle of roughly 30 degrees.

I would have to dig very, very deep in the parts of my brain where all my high-school maths is stored, to come up with a transformation for a roughly 30-degree-turn of a vector. But I am just hoping somebody here on the forum is a bit closer to that and can provide me with a formula.

Posted: Mon Aug 13, 2007 2:52 pm
by JensAyton
If you just provide numbers, it uses absolute co-ordinates in Oolite’s internal co-ordinate system. If you provide a standard co-ordinate system string, that’s used instead.

Posted: Mon Aug 13, 2007 3:05 pm
by Commander McLane
Something like

Code: Select all

position = "pwm 0 0 -1000000";
?

I tried this, but then got a strange effect with the hyperspace rings when I jumped into the system, and a "Press Space Commander" a second later. I don't think that I had placed the planet exactly at the witchpoint and will try very big numbers. But it seemed Oolite didn't swallow it as I wished.

Oh, and I am talking of Oolite 1.65 here because of this.

Nope, with

Code: Select all

position = "pwm 5000000 5000000 5000000";
I get this:
Image

Posted: Mon Aug 13, 2007 3:25 pm
by LittleBear
Yeah, that looks like you got a planet in the face. Radius sets the size and 5000 is the size of the normal Oolite Main Planet, so if you set it to something small, that should make testing easier.

Posted: Mon Aug 13, 2007 3:29 pm
by Commander McLane
Well, my actual planetinfo.plist looks like this:

Code: Select all

{
	"ghosts_planetA" = {
		position = "pwm 5000000 5000000 5000000";
		radius = 2000;
		orientation = "0.0 1.0 0.0 0.0";
		texture = "ghosts_planetA.png";
		seed = "1 2 3 4 5 6";
		"polar_color_factor" = 2.5;
		"rotational_velocity" = 0.13;
	};
	"ghosts_planetB" = {
		position = "-3000000 0 812500";
		radius = 7500;
		orientation = "0.0 1.0 0.0 0.0";
		texture = "ghosts_planetA.png";
		seed = "1 2 3 4 5 6";
		"polar_color_factor" = 2.5;
		"rotational_velocity" = 0.04;
	};

	"2 22" = {
		"ambient_level" = "1.0";
		"sky_blur_alpha" = "0.85";
		"sky_blur_cluster_chance" = "0.88";
		"sky_blur_scale" = "45";
		"script_actions" = (
			"addMoon: ghosts_planetA"
		);
	};
}
(shamelessly copied from Assassins, BTW)

So the radius is 2000 (not too big) and the position should be far, far away from the witchpoint (and my face!).

I guess I am doing something wrong here (obviously), and I appreciate every enlightenment as to what.

Posted: Mon Aug 13, 2007 3:35 pm
by LittleBear
Hmm, that is odd. Only time I blew up was when I foolishly put a Gas-Giant sized planet in the space lane where the Lave Moon is. (Assassins planetinfo code cribbed in turn from Lave.oxp :wink: ). It didn't use pwm for the planets though and used the absolute values that Murgh had used. Try using the position for Murghs Lave moon, then move it say 1000 units and see where it is now. I do remember there being some sort of logic to it, but once I had the distance right I just played around with the numbers to move the left/right and up down positions.

Posted: Mon Aug 13, 2007 3:53 pm
by JensAyton
It could be that one or more of the necessary reference points doesn’t exist yet. However, I remembered that there is a way to get the current absolute position of the player (or any other ship) – use key_dump_target_state.

Posted: Tue Aug 14, 2007 4:16 am
by Commander McLane
Thanks, Ahruman! I'll do that.