Jump to content

Any way to make my ship "float" (autohover) by using vertical engines?


Sethioz

Recommended Posts

i'm trying to build a ship with "auto hover" mode, is that possible somehow? i have tried custom huds, but their altitude hold doesn't use vertical engines, it only works if you're flying fast enough for it to be able to have enough lift, but as soon as i stop, then it drops like a stone.

 

obviously i'm talking in atmosphere and additionally i'd like to remain hovering even when i leave control seat. it's suppose to be a rescue ship, so hovering mode is most important.

i'm sure it's possible by writing own lua, but i'm not lua programmer. i was under the impression that archhud can do this, but maybe i'm just overlooking something.

any ideas? thanks.

Link to comment
Share on other sites

I could do that with my flight script on an ECU., it auto-holds on startup if no floor is detected on activation.

 

It is not an open script and doesn't (yet) have a "normal" flight mode mode (primarily meant for elevators), nor is it free.

Link to comment
Share on other sites

You don't even need the tag IIRC.  Just point them down with a regular flying construct script and use space to go up/c to go down.  It's how the 'magic carpet' worked.  I'm not sure if it will hover or not, if it doesn't you might need alt-space/alt-c or some lua for that.  I can't remember.  When I do this I have a special script which allows vertical-engine-only ships to fly horizontally by pitching or rolling.

Link to comment
Share on other sites

Hovers and vertical boosters dont work beyond their designated height. Unless there is a surface underneath ,or even water . This is how you scan jago oceans for example. turn ground destabilization off alt+8 in archhud and your ship maintains altitude and you can fly under the water. Or harvest your mu tiles under the water . And water counts .In high atmosphere there isnt any "surface" under hovers . So you can do this with engines facing downwards ,like magic carpet  or If your target altitude is more than 1km agg gives more time on hold but more expensive ofc.

 

image.png.092b904dadb446c270241cfa7be7b624.png

Link to comment
Share on other sites

On 3/7/2023 at 12:42 PM, Yoarii said:

I could do that with my flight script on an ECU., it auto-holds on startup if no floor is detected on activation.

 

It is not an open script and doesn't (yet) have a "normal" flight mode mode (primarily meant for elevators), nor is it free.

then why post? just to brag that you have it, but not willing to share? if you're unwilling to help, then don't reply please.

 

On 3/7/2023 at 4:36 PM, CptLoRes said:

To long since I've played to give specific answer, but you need to look into changing engine tags to VERTICAL etc.

any specifics?

 

On 3/7/2023 at 6:42 PM, Zeddrick said:

You don't even need the tag IIRC.  Just point them down with a regular flying construct script and use space to go up/c to go down.  It's how the 'magic carpet' worked.  I'm not sure if it will hover or not, if it doesn't you might need alt-space/alt-c or some lua for that.  I can't remember.  When I do this I have a special script which allows vertical-engine-only ships to fly horizontally by pitching or rolling.

anything specific? i don't want to move up manually, because it's not precise. i need it to hover in exact spot as it's a rescue ship. i can manually go up and down just fine ... but i need it to hover, that's what i couldn't figure out. archhud doesn't seem to have anything specific.

on some reason archhud's hotkeys don't work either even for changing altitude hold level. i can set it with ALT+6 but i can't change it up/down even when flying. i looked up the hotkeys in the guide, but they just don't work on some reason.

 

On 3/7/2023 at 8:25 PM, Habitant said:

Hovers and vertical boosters dont work beyond their designated height. Unless there is a surface underneath ,or even water . This is how you scan jago oceans for example. turn ground destabilization off alt+8 in archhud and your ship maintains altitude and you can fly under the water. Or harvest your mu tiles under the water . And water counts .In high atmosphere there isnt any "surface" under hovers . So you can do this with engines facing downwards ,like magic carpet  or If your target altitude is more than 1km agg gives more time on hold but more expensive ofc.

 

image.png.092b904dadb446c270241cfa7be7b624.png

i'm not talking about vertical boosters or hovers ... i only need to be able to hold altitude in the air while standing still. anywhere between 300m up to where atmosphere ends. that's all i'm after.

 

 

 

Link to comment
Share on other sites

The short answer is yes you can.

The long answer is a bit too long to be explained on a forum post.
You can start to look at API (F1). You need to get the gravity, then you need to apply a thrust = gravity to your vertical engine.

If you want you can contact me on Discord: Leniver#4309

Link to comment
Share on other sites

10 hours ago, Sethioz said:

anything specific? i don't want to move up manually, because it's not precise. i need it to hover in exact spot as it's a rescue ship. i can manually go up and down just fine ... but i need it to hover, that's what i couldn't figure out. archhud doesn't seem to have anything specific.

on some reason archhud's hotkeys don't work either even for changing altitude hold level. i can set it with ALT+6 but i can't change it up/down even when flying. i looked up the hotkeys in the guide, but they just don't work on some reason.

 

I used to just use a regular script for this type of ship but now I have a special script I wrote which does the hovering for me.  I hit space to go up and when I let go it slows down and holds the height I stopped at.  I can tap c or space to nudge up and down at that point.

The lua in the flush call which does the hovering looks like this:
 

                -- Vertical Translation
                local verticalStrafeEngineTags = 'thrust analog vertical'
                if (verticalInput > 0) then
                    unit.setEngineThrust(verticalStrafeEngineTags, 1000000000)
                end

                if (verticalInput == 0) then 
                    local verticalStrafeAcceleration = (-vec3(self.core.getWorldGravity()))  -- force to keep us hovering.
                    local accelerationCommand = verticalStrafeAcceleration * (1 / math.cos(math.rad(curMaxDeg)));
                    Nav:setEngineForceCommand(verticalStrafeEngineTags, accelerationCommand, 0, 'airfoil', 'ground', '', tolerancePercentToSkipOtherPriorities)
                end

                if (verticalInput < 0) then
                    unit.setEngineThrust(verticalStrafeEngineTags, 0)
                end


Where verticalInput is 1/0/-1 for up/hover/down.  

Engines which point down will get the vertical tag automatically.

Edit:
Actually you probably don't need the (1 / math.cos(math.rad(curMaxDeg))) stuff as that's for when the construct is flying by tilting at an angle ...

 

Link to comment
Share on other sites

On 3/9/2023 at 11:51 PM, Zeddrick said:

I used to just use a regular script for this type of ship but now I have a special script I wrote which does the hovering for me.  I hit space to go up and when I let go it slows down and holds the height I stopped at.  I can tap c or space to nudge up and down at that point.

The lua in the flush call which does the hovering looks like this:
 

                -- Vertical Translation
                local verticalStrafeEngineTags = 'thrust analog vertical'
                if (verticalInput > 0) then
                    unit.setEngineThrust(verticalStrafeEngineTags, 1000000000)
                end

                if (verticalInput == 0) then 
                    local verticalStrafeAcceleration = (-vec3(self.core.getWorldGravity()))  -- force to keep us hovering.
                    local accelerationCommand = verticalStrafeAcceleration * (1 / math.cos(math.rad(curMaxDeg)));
                    Nav:setEngineForceCommand(verticalStrafeEngineTags, accelerationCommand, 0, 'airfoil', 'ground', '', tolerancePercentToSkipOtherPriorities)
                end

                if (verticalInput < 0) then
                    unit.setEngineThrust(verticalStrafeEngineTags, 0)
                end


Where verticalInput is 1/0/-1 for up/hover/down.  

Engines which point down will get the vertical tag automatically.

Edit:
Actually you probably don't need the (1 / math.cos(math.rad(curMaxDeg))) stuff as that's for when the construct is flying by tilting at an angle ...

 

thanks, might give it a go, but i was pointed out by another player that default seat is capable of hovering now, i have no idea when they made this update as in the past my ships never hovered with default controls.

you can simply hold brakes at any alt and it will hover, however i'd like to be able to use archhud as it's much cleaner, right now i have to swap seats in order to be able to hover. i have no idea why archhud creator removed hover function.

Link to comment
Share on other sites

Aerogics had a vtol pocket speeder in beta that would hover and extend a force field if you got out of the seat in midair. It worked pretty well. I know the code was in the ecu, but that’s all I know. They aren’t selling it now that I know of. You could hit up Krengus and ask, assuming he’s still playing.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...