Outerra forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Download Outerra Tech Demo. Unofficial Outerra Discord server, MicroProse Discord server for OWS.

Author Topic: Some javascript queries  (Read 12114 times)

zzz

  • Sr. Member
  • ****
  • Posts: 266
  • newbie
Some javascript queries
« 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.
Logged

cameni

  • Brano Kemen
  • Outerra Administrator
  • Hero Member
  • *****
  • Posts: 6721
  • No sense of urgency.
    • outerra.com
Re: Some javascript queries
« Reply #1 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?
Logged

PytonPago

  • Hero Member
  • *****
  • Posts: 2284
  • It´s way too complex, dont let me try to explain !
Re: Some javascript queries
« Reply #2 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.
Logged
We are still undeveloped as long as we don´t realize, that all our science is still descriptive, and than beyond that description lies a whole new world we just haven´t even started to fully understand.

Levi

  • Hero Member
  • *****
  • Posts: 585
    • Outerra Mods Site!
Re: Some javascript queries
« Reply #3 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.
Logged

cameni

  • Brano Kemen
  • Outerra Administrator
  • Hero Member
  • *****
  • Posts: 6721
  • No sense of urgency.
    • outerra.com
Re: Some javascript queries
« Reply #4 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.
Logged

PytonPago

  • Hero Member
  • *****
  • Posts: 2284
  • It´s way too complex, dont let me try to explain !
Re: Some javascript queries
« Reply #5 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.
Logged
We are still undeveloped as long as we don´t realize, that all our science is still descriptive, and than beyond that description lies a whole new world we just haven´t even started to fully understand.

zzz

  • Sr. Member
  • ****
  • Posts: 266
  • newbie
Re: Some javascript queries
« Reply #6 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  ;)
Logged

Levi

  • Hero Member
  • *****
  • Posts: 585
    • Outerra Mods Site!
Re: Some javascript queries
« Reply #7 on: July 29, 2014, 08:03:28 am »

Unfortunately I'm using the vehicle class  ;)
Ah, I think that's another story :P
Logged

PytonPago

  • Hero Member
  • *****
  • Posts: 2284
  • It´s way too complex, dont let me try to explain !
Re: Some javascript queries
« Reply #8 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 (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.
« Last Edit: July 29, 2014, 08:10:42 am by PytonPago »
Logged
We are still undeveloped as long as we don´t realize, that all our science is still descriptive, and than beyond that description lies a whole new world we just haven´t even started to fully understand.

zzz

  • Sr. Member
  • ****
  • Posts: 266
  • newbie
Re: Some javascript queries
« Reply #9 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 (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.
Logged

PytonPago

  • Hero Member
  • *****
  • Posts: 2284
  • It´s way too complex, dont let me try to explain !
Re: Some javascript queries
« Reply #10 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 ...
« Last Edit: July 31, 2014, 01:39:16 am by PytonPago »
Logged
We are still undeveloped as long as we don´t realize, that all our science is still descriptive, and than beyond that description lies a whole new world we just haven´t even started to fully understand.