checking for distance to witchpoint

Discussion and information relevant to creating special missions, new ships, skins etc.

Moderators: winston, another_commander

Post Reply
User avatar
Commander McLane
---- E L I T E ----
---- E L I T E ----
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

checking for distance to witchpoint

Post 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?
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Re: checking for distance to witchpoint

Post 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.
User avatar
Thargoid
Thargoid
Thargoid
Posts: 5528
Joined: Thu Jun 12, 2008 6:55 pm

Post 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.
User avatar
Commander McLane
---- E L I T E ----
---- E L I T E ----
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

Post 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... :?
User avatar
Lestradae
---- E L I T E ----
---- E L I T E ----
Posts: 3095
Joined: Tue Apr 17, 2007 10:30 pm
Location: Vienna, Austria

...

Post 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
User avatar
Kaks
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 3009
Joined: Mon Jan 21, 2008 11:41 pm
Location: The Big Smoke

Post 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... ;)
Hey, free OXPs: farsun v1.05 & tty v0.5! :0)
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Re: checking for distance to witchpoint

Post 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?
User avatar
Commander McLane
---- E L I T E ----
---- E L I T E ----
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

Post 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.)
Post Reply