Space Engineers

Space Engineers

Not enough ratings
Gravity Steering (Grid Torque Provider)
   
Award
Favorite
Favorited
Unfavorite
File Size
Posted
Updated
400.976 KB
6 Apr, 2021 @ 5:45am
12 Aug, 2021 @ 2:23am
2 Change Notes ( view )

Subscribe to download
Gravity Steering (Grid Torque Provider)

Description
The idea
This script implements an alternative "steering" approach using artificial gravity. In SE there is a possibility to apply force to a ship using artificial mass blocks and gravity generators (placed on the very same ship). This can be used to create torque, i.e. rotate a grid (when point where force is applied ends up outside center of mass). Example of gravgens/artmasses outside of CoM generating clock-wise torque (the farther from center, the bigger the impact is):
______
| ^
|GG x GG
|____v

Usage
  1. Paste the code
  2. Make sure you have needed blocks - cockpit, remote, gyro (orientation matters, gyro should point with its' small panel forward).
  3. All mentioned blocks must be in one group, including programmable block
  4. Place gravgen+artmass "clusters", add all blocks to the same group as above

Hints
Remember that gravgen applies its' force to superposition point of all artificial mass blocks, ideally you want to have this point as close to the center of mass axis as possible. The farther the cluster is from the CoM, the more efficient it gets.
To get good Yaw/Pitch control, place clusters on the middle line of your ship, front and back, as far as possible from the center.
For Roll, you want to place them left and right (or up and down) from your center of mass.
The gyro that you add to group acts as a reference to CoM point, it's important to place it close to actual center of mass.

The script has good performance, idling (no user mouse moves, etc) at ~0.015ms, going up to 0.1m/s during extensive large grid steering with 100s of gravgens. Performance is linearly dependent on number of gravgens.

Delta Steering integration
To use with Delta Steering script (recommended) just name the gyro the same as that script requires ("forward-gyro"). If this name is detected, then Grid Torque Provider would listen to gyro override changes done by DS.
12 Comments
cheerkin  [author] 12 Aug, 2021 @ 2:26am 
Добавил проверку, включен ли оверрайд на гироскопе - если нет, то игнорим его. Теперь после вырубания DS скрипт гасит остаточное вращение и засыпает.
cheerkin  [author] 8 Aug, 2021 @ 2:18pm 
Круто, рад, что разобрался. Меня не было на выходных, завтра гляну чё там как.
Super Carrot 7 Aug, 2021 @ 12:55pm 
Вывел кластеры GS чтобы не пересекались с другими полями и само собой разрешилось :emofdr:
Ну и если резко отключать DS, маленькая тяга остаётся.
Super Carrot 7 Aug, 2021 @ 9:45am 
Похоже, что проблема характерна для определенных чертежей, на других кораблях всё отлично работает. Буду разбираться.
cheerkin  [author] 7 Aug, 2021 @ 7:08am 
Сейчас некогда, позже проверю, может обновой что-то поломалось. Должно работать, если параметры скрипта не менялись явным образом.
cheerkin  [author] 7 Aug, 2021 @ 6:53am 
Да, есть условие выключения масс, оказывается.

if (generatingTorque && Variables.Get<bool>("idle-shutdown"))
// меняем состояние

Состояние меняется, если выставлена переменная idle-shutdown (true изначально) и по наличию control torque, отличного от нуля.
Переменную можно выставить в кастом дате так: command:set-value:<name>:<value>, либо выполнив аргументом на пблоке.
control torque - это вектор, представляющего вращение мышкой.
Super Carrot 7 Aug, 2021 @ 6:44am 
Просто массы конфликтуют с перекрывающими полями, возможно сделать toggle на отключение? Я не нашёл аргумента в коде
Super Carrot 7 Aug, 2021 @ 6:43am 
Немного перефразирую, в idle при каком условии переходи скрипт?
У меня Torque выставился на 1 и не меняет состояние
cheerkin  [author] 7 Aug, 2021 @ 6:42am 
Насколько помню, не должны отключаться вообще, из соображений производительности. Включение-выключение масс и гравгенов сравнительно дорого.
Super Carrot 7 Aug, 2021 @ 6:23am 
А массы при каком условии отключаются?