@name Altitude Indicator
@inputs Prop:entity
@outputs 
@persist [Rpos]:vector Amod Yawmax Slipmax Altfeet [Array]:array
@trigger 
interval(125)

if (first() | dupefinished()) {
    Amod = 0
    Yawmax = 150
    Slipmax = 700
    Altfeet = 0
    Backcolor = vec(48,48,48)
    
    entity():setAlpha(0)
    rangerPersist(1)
    Array = entity():getConstraints()
    rangerFilter(Array)
    
    Lpos = vec(0,0,0)
    Rpos = vec(0,0,0)
    Upos = vec(3.1,0,0.25)
    Dpos = vec(-3.1,0,0.25)
    Lp = entity():toWorld(Lpos)
    Rp = entity():toWorld(Rpos)
    Icotex = "phoenix_storms/gear_top"
    Aitex = "phoenix_storms/fender_white"
    
    #right gauge
    holoCreate(1,entity():toWorld(Lpos),vec(0.8,0.8,2),entity():angles(),(Backcolor))
    holoModel(1,"hq_torus")
    holoParent(1,entity())
    
    holoCreate(2,entity():toWorld(Lpos-vec(0,0,-0.6)),vec(0.7,0.7,0.05),entity():toWorld(ang(0,0,0)),(vec(64,64,64)))
    holoMaterial(2,"models/XQM/rails/gumball01a")
    holoModel(2,"hq_cylinder")
    holoParent(2,entity())
    
    #attitude indicator
    holoCreate(3,entity():toWorld(Lpos+vec(0,0,0.075)),vec(0.404,0.404,0.05),entity():toWorld(ang(90,0,0)),vec(255,255,255))
    holoModel(3,"hq_cylinder")
    holoMaterial(3,Icotex)
    holoParent(3,entity())
    
    #top and bottom
    holoCreate(4,entity():toWorld(Lpos+vec(0.05,0,0.07)),vec(0.4,0.4,0.4),entity():toWorld(ang(0,0,0)),vec(0,255,255))
    holoModel(4,"hq_icosphere")
    holoParent(4,3)
    
    holoCreate(5,entity():toWorld(Lpos+vec(-0.05,0,0.07)),vec(0.4,0.4,0.4),entity():toWorld(ang(0,0,0)),vec(15,255,0))
    holoModel(5,"hq_icosphere")
    holoParent(5,3)
    
    holoCreate(6,entity():toWorld(Lpos+vec(3.3,0,0.8)),vec(0.06,0.06,0.09),entity():toWorld(ang(-90,0,0)),vec(255,255,255))
    holoModel(6,"hq_cone")
    holoMaterial(6,Icotex)
    holoParent(6,entity())
    
    holoCreate(7,entity():toWorld(Lpos+vec(2.3,2.3,0.8)),vec(0.06,0.06,0.09),entity():toWorld(ang(-90,45,0)),vec(64,64,64))
    holoModel(7,"hq_cone")
    holoMaterial(7,Icotex)
    holoParent(7,entity())
    
    holoCreate(8,entity():toWorld(Lpos+vec(2.3,-2.3,0.8)),vec(0.06,0.06,0.09),entity():toWorld(ang(-90,-45,0)),vec(64,64,64))
    holoModel(8,"hq_cone")
    holoMaterial(8,Icotex)
    holoParent(8,entity())
    
    holoCreate(9,entity():toWorld(Lpos+vec(0,0,-0.1)),vec(0.45,0.45,1.9),entity():angles(),Backcolor)
    holoModel(9,"hq_torus")
    holoParent(9,entity())
}

holoAng(3,entity():toWorld(ang(90+Prop:angles():yaw(),0,angnorm(Prop:angles():pitch()))))
