@name GRAV SPACE
@persist On

if (first()) {
    runOnTick(1)
    entity():setAngles(ang(0,0,0))
    entity():setSolid(0)
    entity():setPos(owner():pos()+vec(0,0,100))
    timer("Parent",100)
}

if (clk("Parent")) {
    entity():plParent(owner())
    On = 1
}

if (On) {
    rangerFilter(owner())
    RD = rangerOffset(100,owner():pos(),-owner():up())
    if (RD:hit()) {
        entity():setAngles(RD:hitNormal():toAngle()+ang(90,0,0))#:setYaw(owner():angles():yaw()))
        entity():setPos(owner():pos()+vec(0,0,111):rotate(RD:hitNormal():toAngle()+ang(90,0,0)))
    }
}

#rangerFilter(owner())
#RD = rangerOffset(10,owner():pos(),-owner():right())
#if (RD:hit()) {
#    entity():setAngles(RD:hitNormal():toAngle()+ang(90,0,0))
#    entity():setPos(owner():pos()+vec(0,0,100):rotate(RD:hitNormal():toAngle()+ang(90,0,0)))
#}
#
#rangerFilter(owner())
#RD = rangerOffset(10,owner():pos(),owner():right())
#if (RD:hit()) {
#    entity():setAngles(RD:hitNormal():toAngle()+ang(90,0,0))
#    entity():setPos(owner():pos()+vec(0,0,100):rotate(RD:hitNormal():toAngle()+ang(90,0,0)))
#}
#
#rangerFilter(owner())
#RD = rangerOffset(10,owner():pos(),-owner():forward())
#if (RD:hit()) {
#    entity():setAngles(RD:hitNormal():toAngle()+ang(90,0,0))
#    entity():setPos(owner():pos()+vec(0,0,100):rotate(RD:hitNormal():toAngle()+ang(90,0,0)))
#}
#
#rangerFilter(owner())
#RD = rangerOffset(100,owner():pos(),owner():forward())
#if (RD:hit()) {
#    entity():setAngles(RD:hitNormal():toAngle()+ang(90,0,0))
#    entity():setPos(owner():pos()+vec(0,0,111):rotate(RD:hitNormal():toAngle()+ang(90,0,0)))
#}
