Outerra forum

Anteworld - Outerra Game => Modding: Importer, Tools & Utilities => Topic started by: zzz on July 28, 2014, 12:32:39 pm

Title: Some javascript queries
Post by: zzz on July 28, 2014, 12:32:39 pm
I was wondering if Outerra has methods for any of the following:

Getting mouse X and Y coordinates.

Obtaining the same altitude value you see on the HUD

Getting a geom object's local orientation

Thanks.
Title: Re: Some javascript queries
Post by: cameni on July 29, 2014, 12:28:54 am
In FPS/TPS modes there's no mouse pointer, so no mouse coords either. There will be a pointer mode for interaction with the cockpit, when it will be also possible to script the behavior.

Alt/grd values aren't exposed in the API, can be added.

Local geom orientation - not sure what you mean by that. Local joint/bone orientation?
Title: Re: Some javascript queries
Post by: PytonPago on July 29, 2014, 01:26:08 am
In FPS/TPS modes there's no mouse pointer, so no mouse coords either. There will be a pointer mode for interaction with the cockpit, when it will be also possible to script the behavior.

So you plan something like the DCSs cockpit-click mode (as they have a free-look mode and the click-mode, where the pointer appears and stuff becomes usable this way) ? Will that be doable for ground vehicles too ? Know, that most ground-sims still stick to keyboard entry-es, but making a "full-click cockpit" for tanks and artillery pieces would be a perfect thing.
Title: Re: Some javascript queries
Post by: Levi on July 29, 2014, 03:12:17 am
Obtaining the same altitude value you see on the HUD
Used in aircraft script:

On the HUD:
jsb['position/h-sl-ft']                Get feet above sea level.
jsb["position/h-agl-ft"]             Get feet above ground level.

Not on the HUD:
jsb['position/h-sl-meters']        Get meters above sea level.
Title: Re: Some javascript queries
Post by: cameni on July 29, 2014, 03:52:01 am
So you plan something like the DCSs cockpit-click mode (as they have a free-look mode and the click-mode, where the pointer appears and stuff becomes usable this way) ? Will that be doable for ground vehicles too ? Know, that most ground-sims still stick to keyboard entry-es, but making a "full-click cockpit" for tanks and artillery pieces would be a perfect thing.
Yes, something that will be producing 3D model-space coordinates of mouse events in cockpit mode, which you can handle in the script and do whatever you need.
Title: Re: Some javascript queries
Post by: PytonPago on July 29, 2014, 04:58:32 am
So you plan something like the DCSs cockpit-click mode (as they have a free-look mode and the click-mode, where the pointer appears and stuff becomes usable this way) ? Will that be doable for ground vehicles too ? Know, that most ground-sims still stick to keyboard entry-es, but making a "full-click cockpit" for tanks and artillery pieces would be a perfect thing.
Yes, something that will be producing 3D model-space coordinates of mouse events in cockpit mode, which you can handle in the script and do whatever you need.

So you probably add another page (or menu-article) to the importer for such objects, whyte some .txt file whyte the object names being created ?  A script could be called at the base of the .js file to make them from existing mesh-objects (like defining objects for hiding ), but i can imagine it to be a bigger problem then ... will be a handy thing. Cant wait to make the grads control panel work.
Title: Re: Some javascript queries
Post by: zzz on July 29, 2014, 07:55:08 am
Thanks, none of these requests should be considered urgent. Just casual inquiries.

Quote
Local geom orientation - not sure what you mean by that. Local joint/bone orientation?

Yes, I have a multi-jointed turret and when one joint reaches its max rotation I'd like it to switch to the next joint. Get_rot is in quaternions and I don't know how to convert it, get_joint_local_pos doesn't change value with rotation (assuming because it's measuring the pos of pivot point). I thought about measuring when its angular velocity hits zero despite rotateTurret == 1 but that function's for the whole vehicle only.

Obtaining the same altitude value you see on the HUD
Used in aircraft script:

On the HUD:
jsb['position/h-sl-ft']                Get feet above sea level.
jsb["position/h-agl-ft"]             Get feet above ground level.

Not on the HUD:
jsb['position/h-sl-meters']        Get meters above sea level.

Unfortunately I'm using the vehicle class  ;)
Title: Re: Some javascript queries
Post by: Levi on July 29, 2014, 08:03:28 am
Unfortunately I'm using the vehicle class  ;)
Ah, I think that's another story :P
Title: Re: Some javascript queries
Post by: PytonPago on July 29, 2014, 08:07:04 am
Yes, I have a multi-jointed turret and when one joint reaches its max rotation I'd like it to switch to the next joint. Get_rot is in quaternions and I don't know how to convert it, get_joint_local_pos doesn't change value with rotation (assuming because it's measuring the pos of pivot point). I thought about measuring when its angular velocity hits zero despite rotateTurret == 1 but that function's for the whole vehicle only.

Did you see my 4-turret script ? : - http://forum.outerra.com/index.php?topic=2596.msg27512#msg27512 (http://forum.outerra.com/index.php?topic=2596.msg27512#msg27512) (download the .otx from my post)

I think, you could change the "selector variable" when the turret rotation hits its maximum, to change to another or something similar with that kind of stuff ... at-least for now.
Title: Re: Some javascript queries
Post by: zzz on July 30, 2014, 03:21:25 pm
Yes, I have a multi-jointed turret and when one joint reaches its max rotation I'd like it to switch to the next joint. Get_rot is in quaternions and I don't know how to convert it, get_joint_local_pos doesn't change value with rotation (assuming because it's measuring the pos of pivot point). I thought about measuring when its angular velocity hits zero despite rotateTurret == 1 but that function's for the whole vehicle only.

Did you see my 4-turret script ? : - http://forum.outerra.com/index.php?topic=2596.msg27512#msg27512 (http://forum.outerra.com/index.php?topic=2596.msg27512#msg27512) (download the .otx from my post)

I think, you could change the "selector variable" when the turret rotation hits its maximum, to change to another or something similar with that kind of stuff ... at-least for now.

Yes, your scripts is the basis for my turret control. But how would you tell the turret rotation has hit is max, unless you mean manually pressing a button to switch it when you see it's not moving anymore?

Was also going to use rotation for an auto-level flight mechanic.
Title: Re: Some javascript queries
Post by: PytonPago on July 31, 2014, 12:16:04 am
You define a maximum value for X and Y rotation angles - can try make a IF (whatiwant == rotxmax). But true, there must be thought about it getting back the same ... maybe, adding that, when the angular/rad speed hits the zero at the same time as it is at the max, it will change it from one to another (there could be the "openbool" script used to keep track witch part is moving and to witch it has to change at that point).  This way, maybe you have to re-click the direction-rotation key - what may be a pain when the turret has to rotate fluently ...