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: getting info on terrain material from world position  (Read 9199 times)

fly77

  • Outerra Master Modder
  • Hero Member
  • *****
  • Posts: 1761
getting info on terrain material from world position
« on: November 22, 2018, 04:12:17 pm »

Is there a way to access from within a javascript the material of the terrain at a given latitude , longitude  ? I know it is possible inside vehicle scripts interrogating the wheel_data    material property. However this only tests the material at the location where the wheel stands and to know material property at another location I need to drive there. Instead I would like to know the material property of the terrain just by giving world position coordinates. Is there any way ?
Logged

cameni

  • Brano Kemen
  • Outerra Administrator
  • Hero Member
  • *****
  • Posts: 6721
  • No sense of urgency.
    • outerra.com
Re: getting info on terrain material from world position
« Reply #1 on: November 28, 2018, 04:38:18 am »

There are some internal APIs for that, but generally the query results can be arbitrarily imprecise or flat wrong if there's no observer at or near the queried location, that would cause the measurement to be more precise.

You know, quantum uncertainty and all that :)
Logged

fly77

  • Outerra Master Modder
  • Hero Member
  • *****
  • Posts: 1761
Re: getting info on terrain material from world position
« Reply #2 on: November 28, 2018, 05:14:36 am »

Is it possible for us to access/use these"internal" apis? In case where can i find them?
« Last Edit: November 28, 2018, 05:54:18 am by fly77 »
Logged

cameni

  • Brano Kemen
  • Outerra Administrator
  • Hero Member
  • *****
  • Posts: 6721
  • No sense of urgency.
    • outerra.com
Re: getting info on terrain material from world position
« Reply #3 on: November 28, 2018, 05:23:28 am »

It's possible, but it's undocumented because we don't want to support that mode of access for mods, but rather to make some kind of a sensor API that can be better controlled and used in future game/sim modes.

What's the intended use for it?
Logged

fly77

  • Outerra Master Modder
  • Hero Member
  • *****
  • Posts: 1761
Re: getting info on terrain material from world position
« Reply #4 on: November 28, 2018, 05:55:37 am »

I was thinking about a way to place my streetlamps automatically along roads by spawning a single "vehicle" in some place which then probes the terrain around to place multiple streetlamp meshes along roads nearby so that all can be lit by spawning a single instance of streetlamp
« Last Edit: November 28, 2018, 06:02:15 am by fly77 »
Logged

cameni

  • Brano Kemen
  • Outerra Administrator
  • Hero Member
  • *****
  • Posts: 6721
  • No sense of urgency.
    • outerra.com
Re: getting info on terrain material from world position
« Reply #5 on: November 28, 2018, 06:26:41 am »

The resolution gets gradually worse the farther you are, and that applies to the query API as well, unless you perform some asynchronous terrain data requests ... it can get ugly.

Besides, new road format will allow enabling "features" generated along the roads, such as guard rails, poles, lamps etc, which will be able to place them precisely (and automatically).
Logged

fly77

  • Outerra Master Modder
  • Hero Member
  • *****
  • Posts: 1761
Re: getting info on terrain material from world position
« Reply #6 on: November 28, 2018, 07:25:55 am »

Thanks cameni. In fact I was already abandonding the idea as for the moment it is good enough to enjoy outerra villages by night by placing manually streetlamps in the editor as vehicles and lighting them one by one passing by each of them entering and exiting each "vehicle"-streetlamp. So I am waiting for the new update of outerra including also active streetlamps..which i found contribute a lot to enjoy outerra by night. Thanks once again and keep on your great work! Outerra is fantastic!
« Last Edit: November 28, 2018, 08:27:16 am by fly77 »
Logged

KW71

  • Outerra Developer
  • Hero Member
  • *****
  • Posts: 762
  • Love OT!
Re: getting info on terrain material from world position
« Reply #7 on: November 28, 2018, 11:07:18 am »

Hi, fly77!
For the time being, if you still want to have some fun, you could create models with different amount of lamps: 1, 2, 4, 8, 16... and the script to activate all the lamps on the model at once...
Logged
"A man who is contented with what he has done, will never become famous for what he will do".

fly77

  • Outerra Master Modder
  • Hero Member
  • *****
  • Posts: 1761
Re: getting info on terrain material from world position
« Reply #8 on: November 28, 2018, 01:24:59 pm »

Hi KW71. In fact i tried that but for the moment gave up because I could't manage to place a vehicle that supports a row of poles of say 4 or 6 streetlamps  all at the right height with respect to their local terrain level. Indeed as their positions are rigidly linked to the "base" vehicle their height above terrain depends also on the heading pitch and roll of the "base vehicle" and of course on the terrain and the farther you go from the base point the more difficult it is to keep all lamps at the correct height unless the terrain is perfectly level - which of course is the case in planes but not in mountains or hills even small ones. As in the end I found it is relatively fast to run from one lamp to the other to switch it on for the moment I am satisfied also because using individual lamps keeps things simple. Eventually it is computationally more intensive as more instances of lamps need to be placed, i guess. Anyway maybe I can still make a row of lamps controlled from a single "base vehicle" by using the move_joints command attaching bones to the lamp meshes and by probing the terrain level under the lamps...which I know how to do ..then adjust the individual lamp heights as needed. I'll give it a try when I have time. Thanks for keeping my interest alive on this aspect which I had for the moment set aside.
« Last Edit: November 28, 2018, 01:35:15 pm by fly77 »
Logged