Welcome to Keen Software House Forums! Log in or Sign up to interact with the KSH community.
  1. You are currently browsing our forum as a guest. Create your own forum account to access all forum functionality.

Check altitude

Discussion in 'Programming (In-game)' started by Sich, May 16, 2018.

Thread Status:
This last post in this thread was made more than 31 days old.
  1. Sich Trainee Engineer

    Messages:
    89
    Hi,

    I try to make a drone who get in space and then come back to land.

    I usually use "Visual Script Builder" to make my scripts and it's work fine.
    But I want something that isn't possible with this site.

    To go down on the planet I shutdown all the engine from my drone.
    This to not use too much fuel, and because of the speed bug in gravity.

    I need something like "If altitude < 1500m do start all engine".

    I have find this script : https://steamcommunity.com/sharedfiles/filedetails/?id=1103394724 and I will try to use it. But this seem really to "big" for what I need... I only need how to check the current altitude and start my engine or a timer.

    Someone have some idea about that ?
    Or maybe how to check if the parachute hatch is open ? Then I add a parachute hatch on my drone and set the auto opening at 1500m.

    I hope that someone can help me :)


    [EDIT]
    I have find the way to do that. I have use this :
    v0.TryGetPlanetElevation( MyPlanetElevation.Surface, out alt );
    [/EDIT]
     
    Last edited: May 16, 2018
  2. Wicorel Senior Engineer

    Messages:
    1,231
    Every IMyShipController and a way to get Elevation.

    Code:
    controller.TryGetPlanetElevation(MyPlanetElevation.Surface, out elevation);
    
    That will tell you the height of that controller above the surface.
     
  3. Sich Trainee Engineer

    Messages:
    89
    Yep thx it's exactly what I have use for my script !
     
  4. Ronin1973 Master Engineer

    Messages:
    4,456
    You can also query the planet's center as well as altitude above the planet's center. Depending on your task you may want information from the absolute value or relative to the surface (which varies all over the planet).
     
Thread Status:
This last post in this thread was made more than 31 days old.