Space Engineers
Недостаточно оценок
Gravity Steering (Grid Torque Provider)
   
Наградить
В избранное
В избранном
Удалить
Размер файла
Добавлен
Изменён
400.976 KB
6 апр. 2021 г. в 5:45
12 авг. 2021 г. в 2:23
Обновлений: 2 (просмотреть)

Подпишитесь, чтобы загрузить
Gravity Steering (Grid Torque Provider)

Описание
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
cheerkin  [создатель] 12 авг. 2021 г. в 2:26 
Добавил проверку, включен ли оверрайд на гироскопе - если нет, то игнорим его. Теперь после вырубания DS скрипт гасит остаточное вращение и засыпает.
cheerkin  [создатель] 8 авг. 2021 г. в 14:18 
Круто, рад, что разобрался. Меня не было на выходных, завтра гляну чё там как.
Super Carrot 7 авг. 2021 г. в 12:55 
Вывел кластеры GS чтобы не пересекались с другими полями и само собой разрешилось :emofdr:
Ну и если резко отключать DS, маленькая тяга остаётся.
Super Carrot 7 авг. 2021 г. в 9:45 
Похоже, что проблема характерна для определенных чертежей, на других кораблях всё отлично работает. Буду разбираться.
cheerkin  [создатель] 7 авг. 2021 г. в 7:08 
Сейчас некогда, позже проверю, может обновой что-то поломалось. Должно работать, если параметры скрипта не менялись явным образом.
cheerkin  [создатель] 7 авг. 2021 г. в 6:53 
Да, есть условие выключения масс, оказывается.

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

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