Outerra forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Outerra Tech Demo download. Help with graphics driver issues

Pages: [1] 2

Author Topic: External Dynamic Data  (Read 11788 times)

dac

  • Jr. Member
  • *
  • Posts: 14
  • newbie
External Dynamic Data
« on: August 22, 2014, 09:22:35 am »

Hello,

I was wondering, how well is suited Outerra for visualizing GIS type information? If I have a list of real life objects with a lat,lon position - is it possible to dynamically add and modify their position in the engine? Imagine having a GPS on a car and visualizing the car move inside the engine based on the real coordinates.

From what i've been able to tell you're currently only able to add static objects via the editor but I could be mistaken.

Is this something that will be possible down the road?
Logged

cameni

  • Brano Kemen
  • Outerra Administrator
  • Hero Member
  • *****
  • Posts: 6721
  • No sense of urgency.
    • outerra.com
Re: External Dynamic Data
« Reply #1 on: August 22, 2014, 09:42:32 am »

You can modify positions and orientations of dynamic objects (like vehicles or aircraft) via script, but you can't easily access external data from the script. This will need an API able to sync positions of objects from outside, with an option to clip the position to terrain height.
Logged

dac

  • Jr. Member
  • *
  • Posts: 14
  • newbie
Re: External Dynamic Data
« Reply #2 on: August 22, 2014, 10:31:32 am »

How much of this is possible in the current alpha version?

The main problem would be to retrieve external data (coming through a web interface, stream or a REST like thing)?

Thanks for the info.
Logged

cameni

  • Brano Kemen
  • Outerra Administrator
  • Hero Member
  • *****
  • Posts: 6721
  • No sense of urgency.
    • outerra.com
Re: External Dynamic Data
« Reply #3 on: August 22, 2014, 12:47:00 pm »

There's an IGC interface that allows controlling the camera, maybe it could be extended to allow also spawning vehicles and controlling them, in a limited way. With IGC you can currently write a C++ addon that gets invoked each frame to handle the camera.
Logged

dac

  • Jr. Member
  • *
  • Posts: 14
  • newbie
Re: External Dynamic Data
« Reply #4 on: August 28, 2014, 03:34:32 am »

Thank you for your answers. Is there any material available regarding the API or examples of how to get started?
Logged

dac

  • Jr. Member
  • *
  • Posts: 14
  • newbie
Re: External Dynamic Data
« Reply #5 on: August 29, 2014, 10:27:46 am »

And as a follow up, been looking around the game files. Would my idea be accomplisable if I scripted it via the jquery stuff in \www\.

For instance in your vehicle spawning
$app.spawn_vehicle(selected.attr("id")); is used.
Is it possible to call a spawn script with a specific unique id, a latlon position and model? And then dynamically from within the script (objects stored in a hashmap or similar) update each objects position from an outside source?

Could simply trigger the script when opening one of the maps.
Logged

cameni

  • Brano Kemen
  • Outerra Administrator
  • Hero Member
  • *****
  • Posts: 6721
  • No sense of urgency.
    • outerra.com
Re: External Dynamic Data
« Reply #6 on: August 29, 2014, 10:58:25 am »

Here's some info on IGC & examples: http://forum.outerra.com/index.php?topic=2705.msg28404#msg28404
Also this http://forum.outerra.com/index.php?topic=2210.0

$app.spawn_vehicle(selected.attr("id")); is used.
Is it possible to call a spawn script with a specific unique id, a latlon position and model? And then dynamically from within the script (objects stored in a hashmap or similar) update each objects position from an outside source?
That id is only valid in that dialog, and it's an id of type, not of instance.

There's a (preliminary) way to create instances through script from ui windows:
Code: [Select]
var world = $eview.$query_interface("ot::js::world.get");
var v = world.create_instance("outerra/mig29/mig29", pos, rot, false);

...

v.set_pos(p)
v.set_rot(r)
Logged

dac

  • Jr. Member
  • *
  • Posts: 14
  • newbie
Re: External Dynamic Data
« Reply #7 on: August 29, 2014, 11:01:56 am »

Yes I figured the ID was a reference to the selected vehicle in the dialog (ie. which car or truck). But if I have multiple objects spawned in, I would want a way to keep a track of them by using some sort of unique ID.

Is it possible to attach such an ID to an ingame object and then later retrieve them & modify their properties such as location?

Thanks for the help.
Logged

dac

  • Jr. Member
  • *
  • Posts: 14
  • newbie
Re: External Dynamic Data
« Reply #8 on: September 02, 2014, 07:09:40 am »

I've tried to use your example given but it is not working.

Right now i'm trying to spawn a basic object at the latlon 0,0, with 1km height which in the  ECEF should be

x = 6370
y = 0
z = 0

http://www.oc.nps.edu/oc2902w/coord/llhxyz.htm

The pos looks to be a double3 which isn't a native javascript object as far as I know but i've tried both as

Code: [Select]
var pos = {
x:6379,
y:0,
z:0
};

Which gives me a Error reading struct opening token fatal error
or simply as
Code: [Select]
var pos;

pos.x = 6379;
pos.y = 0;
pos.z = 0;

The rest of the code is as you provided

Code: [Select]
var world = $eview.$query_interface("ot::js::world.get");
var rot = 90;
var v = world.create_instance("outerra/ddg/ddg", pos, rot, false);

//Dynamic update? resetting val
v.set_pos(pos);
v.set_rot(rot);

Either it crashes or nothing happens. I've chosen the large ship, which in position 0.0 should be fairly easy to spot if something was being spawned in.

What am I doing wrong?
Any tips for selecting height to be waveheight in a given position?


I also tried taking the position from the IGC using

Code: [Select]
var igc = $eview.$query_interface("ot::js::igc.get");
var pos = igc.pos();

Which immediately crashes the software.

Thanks
Logged

cameni

  • Brano Kemen
  • Outerra Administrator
  • Hero Member
  • *****
  • Posts: 6721
  • No sense of urgency.
    • outerra.com
Re: External Dynamic Data
« Reply #9 on: September 02, 2014, 09:25:56 am »

Where are you running the scripts?

A couple of obvious issues - ECEF coordinates should be in meters, and rotation is a quaternion (rotation from ECEF frame). It's rather clumsy to work with these in JS, we will need a vector math library there.
Logged

dac

  • Jr. Member
  • *
  • Posts: 14
  • newbie
Re: External Dynamic Data
« Reply #10 on: September 02, 2014, 09:27:58 am »

I'm attaching a JS file to the mapnav.html OSM

Would it be possible to get a working example which I could modify/learn from?

Thanks for your help
Logged

cameni

  • Brano Kemen
  • Outerra Administrator
  • Hero Member
  • *****
  • Posts: 6721
  • No sense of urgency.
    • outerra.com
Re: External Dynamic Data
« Reply #11 on: September 02, 2014, 12:16:15 pm »

I'll try to make some, but only after the next release. Ping me if I forget.
Logged

dac

  • Jr. Member
  • *
  • Posts: 14
  • newbie
Re: External Dynamic Data
« Reply #12 on: September 03, 2014, 12:40:10 pm »

Great thanks!
Logged

dac

  • Jr. Member
  • *
  • Posts: 14
  • newbie
Re: External Dynamic Data
« Reply #13 on: September 18, 2014, 05:28:33 am »

Did you get a chance to look at it/address it in the new update?

Thanks

David
Logged

cameni

  • Brano Kemen
  • Outerra Administrator
  • Hero Member
  • *****
  • Posts: 6721
  • No sense of urgency.
    • outerra.com
Re: External Dynamic Data
« Reply #14 on: September 19, 2014, 01:31:55 am »

Not yet, but I'll make an example. Probably including the lat/lon conversion to ECEF - I guess your inputs will be in lat/lon+alt.
Logged
Pages: [1] 2