Space Engineers

Space Engineers

Not enough ratings
3-Axis Gravity Drive v2.0
   
Award
Favorite
Favorited
Unfavorite
File Size
Posted
5.017 KB
23 Jun, 2016 @ 8:29pm
1 Change Note ( view )

Subscribe to download
3-Axis Gravity Drive v2.0

Description
3-axis Gravity Drive v2.0

Pilot gravity driven ship in full 3-axis using standard WASD movement.

Setup:
Place 6 small ion thrusters anywhere on the ship, each facing a different direction.
Place various gravity generators facing whichever desired direction.
Place various artificial mass blocks.
Change the name of all of the above items to include the "[GD]" tag (configurable in script).
Place a programming block containing this code.
Place a timer block. Set timer to 1 second and set its actions to "Trigger Now" on itself, "Start" on itself, as well as "Run" the programming block (DO NOT choose "Run with default argument". Instead just choose "Run" and leave the field blank and hit ok.)
On the programming block, manually run once with the argument of "Reset".
This will automatically set the field strength of all of your gravity generators to exactly encompass the artificial mass blocks.
Start the timer and you're good to go.

The script can handle docking / undocking via both connectors and merge blocks. It can also handle the destruction of any participating block. However, if any connectors, merge blocks, power sources, gravity generators,artificial masses, or flight seats are built, rerun the program block manually with the argument of "Reset" to rescan the ship for any newly added components.

To disable the system, run the programming block with the argument of "Stop". To restart it from here, simply turn the programming block back on.

If docking 2 gravity driven ships together, one should have its drive disabled as per above.

The script detects dampeners attempting to come to a stop and will bring the ship to a complete stop most of the time. Occasionally, very small/fast gravity driven ships won't come to a complete stop. This can usually be fixed by moving the ship a small amount.

The ideal ratio of gravity generators to artificial mass blocks depends on ship requirements. For space efficiency, use a 1:1 ratio. For power efficiency, it depends on how far apart the components are placed but a reasonable design will have around 10:1 gravity generators to artificial mass ratio.

A few example ships have been posted as well:
Space efficient
https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=710088703

Power Efficient
https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=710085841

Small Ship
https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=710087426
39 Comments
Rizzo 20 Jun, 2021 @ 4:14pm 
I was using this script for quite some time, but it appears bugged after recent updates. There are a lot of warnings in the script now and the two ships I had this on had issues with thrusting and thrusters being turned off by the script.
sHanQ 17 Aug, 2017 @ 8:29am 
alright, thanks mate!
BurninSun  [author] 17 Aug, 2017 @ 7:54am 
The tagging does not work on groups, so that may be the issue - I never tested how the script reacts to not having a certain component working and in this case it wouldn't have the mass blocks.

That said, there should be a MUCH simpler script available these days as I'm pretty sure they finally exposed the thruster force property to the in game programming API. That would cut the meat of the script down to about 6 lines of code. As I haven't playing in years, I'd suggest looking for an alternative script.
sHanQ 16 Aug, 2017 @ 11:57pm 
o/ hey

had the same idea for a script too, googled for it and found yours.. good job as far as i can tell, got a little problem

i have everything setup just the way you listed it above... i've named everything like this: http://i.imgur.com/aODRK7x.png (hope the group of mass blocks is fine this way)

unfortunately the gravity generators turn off upon running the script and never turn on again. they are not mirroring the thrusters at all

any clue what the issue might be?
BurninSun  [author] 14 Apr, 2017 @ 10:50pm 
Is it actually broken or just giving "obsolete" errors? I don't intend to do much fixing when there is new API that has been sitting on the experimental branch for over a year now that would reduce this script to just a couple lines of code. So if its just the obsolete error, just ignore it until if/when they decide to push the API changes live.
E-Man720 14 Apr, 2017 @ 7:47am 
Is there any ideas where this is at now? Or if theres a fixed variant?
BurninSun  [author] 24 Feb, 2017 @ 7:50pm 
The SE devs streamlined their API a bit meaning old function calls will be removed from the game at some point. The obsolete thing is just a warning to update to the new calls so they can be safely ignored for the moment. For this script in particular though, they have been working on new features that would make the majority of this code obsolete in favor of something much simpler. So I probably won't fix this just because when those new features go live (which are currently working in the experimental branch) I would think someone else would put out a revised script that accomplishes the same thing this one does with much less code.
Copycat80 21 Feb, 2017 @ 2:20pm 
whenever I check the code, it gives me multiple arguments that are "obsolete" can you fix them , or is the problem on my end?
BurninSun  [author] 5 Feb, 2017 @ 11:18pm 
Using things like autopilot or getting coordinates based on direction don't work because there is no way to tell the difference between unwated drift and the pilot purposefully rotating the ship.

There is (as far as I know) no easy way to get the moment of inertia for a ship. So there is no way to calculate torque which would then be easy to correct with gyros.

That said, it would be possible to use "orphan" gravity drives that don't overlap the base drive placed on the extremes of each of the 3 axis (only 1 set needed per axis due to being able to set both positive and negative gravity). Then for each axis, calculate the location of the acceleration axis from the base gravity drive components then calculate the strength needed on the orphan drive to bring that acceleration axis in line with the center of mass of the ship. All of that could be done on script initialization if you don't need to take into account adjustments due to ship damage or cargo loads.
Metavamp 3 Feb, 2017 @ 1:58pm 
Any ideas on a way to balance a ship's center of mass using 4 grav ball drives? Maybe auto pilot compensation could be used, if one could make a camera lase a gps point in the distance to follow, and then adjust grav ball mass from that. Might get it close. Great script!