Page 1 of 1

checking for distance to witchpoint

Posted: Sat Sep 26, 2009 4:33 pm
by Commander McLane
I've got a JS-question: Is there a way to check in a ship-script for the distance between the calling ship and the witchpoint? Note: I am specifically asking not about the witchpoint beacon, but about the witchpoint (wpm 0 0 0).

Is it for instance possible to use this.ship.position.distanceTo("wpm", [0, 0, 0])? I guess not, because according to the wiki distanceTo() expects only a vector expression, not a preceding coordinate system string.

However, is there an alternative way?

Re: checking for distance to witchpoint

Posted: Sat Sep 26, 2009 4:50 pm
by Eric Walch
Commander McLane wrote:
I've got a JS-question: Is there a way to check in a ship-script for the distance between the calling ship and the witchpoint?
I think not. The buoy is put at exactly the 0,0,0 coordinate in the wpm system. But that needs the buoy to be present. In absolute coordinates the withchpoint is positioned at a random location of half a scanner range around the abs 0,0,0 coordinate.

No idea why that random deviation as a player never can see the difference.

Posted: Sat Sep 26, 2009 4:55 pm
by Thargoid
A rather clunky way would be to spawn something at [0,0,0], check the distance to that and then remove it again.

Posted: Sat Sep 26, 2009 5:09 pm
by Commander McLane
Rather clunky, indeed.

So I'll check for the distance to the beacon and just hope that it always will exist when the check is performed... :?

...

Posted: Sat Sep 26, 2009 5:29 pm
by Lestradae
Couldn't you spawn a super-small "special beacon" at wpm 0 0 0 just for the check in any case and immediately remove it after the check?

That way, no player would notice anything of the procedure even if near the W beacon, and there is no error if the actual beacon has been destroyed prior to the check.

:idea: :?:

L

Posted: Sat Sep 26, 2009 6:21 pm
by Kaks
Thargoid wrote:
A rather clunky way would be to spawn something at [0,0,0], check the distance to that and then remove it again.
Clunkier still, look for the witchpoint buoy, and if not found, create a splinter at wpm 0 0 0 read its position & then destroy it! I did something similar to that for my first version of hotrods as that was the only way to determine the Witchpoint for my crude wpm2abs function. Ah, those were the days, we didn't have a fancy 'abs' system way back then... ;)

Re: checking for distance to witchpoint

Posted: Sat Sep 26, 2009 6:41 pm
by JensAyton
Commander McLane wrote:
I've got a JS-question: Is there a way to check in a ship-script for the distance between the calling ship and the witchpoint? Note: I am specifically asking not about the witchpoint beacon, but about the witchpoint (wpm 0 0 0).
Just to be clear here, wpm (0 0 0) is where the witchspace beacon is spawned. I’m not entirely clear on why this point is slightly offset to the origin (and all ships entering, including the player, are also slightly offset from the origin) – it’s probably a thinko or misunderstanding.

In fact, as far as I can see, there would be no problem at all in removing the offset and just putting the beacon (and “w” reference point) at the origin. Thoughts?

Posted: Mon Sep 28, 2009 12:46 pm
by Commander McLane
Probably it is just for adding some randomness? Like the wpm-system is spawned within the abs-system via a addShipsAt instead of a addShipsAtPrecisely (if you get the picture)?

In my opinion the witchpoint could easily be placed exactly at the origin. I don't see any downsides (and no upsides of the current placement).

Ah :idea: here could be one: Could it be that internally the difference between addShipsAt (somewhere close to the specified coordinates) and addShipsAtPrecisely (exactly at the specified coordinates) is created by using the internal system for addShipsAt (which will result in a slight offset from the wpm or whatever coordinate specified)? So placing the beacon exactly at the origin would effectively destroy the difference between addShipsAt and addShipsAtPrecisely?

----------

By the way: another offset that still bugs me is the ca. 16° offset of the rotational axis of planets from the plane. And of course the fact that this offset is completely fixed and not influencable via script or plist. (The orientation-setting in planetinfo.plist only changes how the texture is wrapped around the planet, not the actual rotational angle of the planet.)